summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1172
blob: 5e36746d75dfac0a36369c70edaafc27cbdfcce1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1172
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.1172
Problem:    Cursor properties were not fully tested.
Solution:   Add a test. (Dominique Pelle, closes #4256)
Files:	    src/testdir/test_terminal.vim


*** ../vim-8.1.1171/src/testdir/test_terminal.vim	2019-04-13 23:18:18.204706885 +0200
--- src/testdir/test_terminal.vim	2019-04-14 14:12:00.814528816 +0200
***************
*** 1892,1897 ****
--- 1892,1954 ----
    call WaitForAssert({-> assert_equal(v:null, term_getjob(term)) })
  endfunc
  
+ func Test_term_getcursor()
+   if !has('unix')
+     return
+   endif
+   let buf = Run_shell_in_terminal({})
+ 
+   " Wait for the shell to display a prompt.
+   call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))})
+ 
+   " Hide the cursor.
+   call term_sendkeys(buf, "echo -e '\\033[?25l'\r")
+   call WaitForAssert({-> assert_equal(0, term_getcursor(buf)[2].visible)})
+ 
+   " Show the cursor.
+   call term_sendkeys(buf, "echo -e '\\033[?25h'\r")
+   call WaitForAssert({-> assert_equal(1, term_getcursor(buf)[2].visible)})
+ 
+   " Change color of cursor.
+   call WaitForAssert({-> assert_equal('', term_getcursor(buf)[2].color)})
+   call term_sendkeys(buf, "echo -e '\\033]12;blue\\007'\r")
+   call WaitForAssert({-> assert_equal('blue', term_getcursor(buf)[2].color)})
+   call term_sendkeys(buf, "echo -e '\\033]12;green\\007'\r")
+   call WaitForAssert({-> assert_equal('green', term_getcursor(buf)[2].color)})
+ 
+   " Make cursor a blinking block.
+   call term_sendkeys(buf, "echo -e '\\033[1 q'\r")
+   call WaitForAssert({-> assert_equal([1, 1],
+   \ [term_getcursor(buf)[2].blink, term_getcursor(buf)[2].shape])})
+ 
+   " Make cursor a steady block.
+   call term_sendkeys(buf, "echo -e '\\033[2 q'\r")
+   call WaitForAssert({-> assert_equal([0, 1],
+   \ [term_getcursor(buf)[2].blink, term_getcursor(buf)[2].shape])})
+ 
+   " Make cursor a blinking underline.
+   call term_sendkeys(buf, "echo -e '\\033[3 q'\r")
+   call WaitForAssert({-> assert_equal([1, 2],
+   \ [term_getcursor(buf)[2].blink, term_getcursor(buf)[2].shape])})
+ 
+   " Make cursor a steady underline.
+   call term_sendkeys(buf, "echo -e '\\033[4 q'\r")
+   call WaitForAssert({-> assert_equal([0, 2],
+   \ [term_getcursor(buf)[2].blink, term_getcursor(buf)[2].shape])})
+ 
+   " Make cursor a blinking vertical bar.
+   call term_sendkeys(buf, "echo -e '\\033[5 q'\r")
+   call WaitForAssert({-> assert_equal([1, 3],
+   \ [term_getcursor(buf)[2].blink, term_getcursor(buf)[2].shape])})
+ 
+   " Make cursor a steady vertical bar.
+   call term_sendkeys(buf, "echo -e '\\033[6 q'\r")
+   call WaitForAssert({-> assert_equal([0, 3],
+   \ [term_getcursor(buf)[2].blink, term_getcursor(buf)[2].shape])})
+ 
+   call Stop_shell_in_terminal(buf)
+ endfunc
+ 
  func Test_term_gettitle()
    " term_gettitle() returns an empty string for a non-terminal buffer
    " and for a non-existing buffer.
*** ../vim-8.1.1171/src/version.c	2019-04-14 13:23:36.911963919 +0200
--- src/version.c	2019-04-14 14:08:16.615451205 +0200
***************
*** 773,774 ****
--- 773,776 ----
  {   /* Add new patch number below this line */
+ /**/
+     1172,
  /**/

-- 
There is a fine line between courage and foolishness.
Unfortunately, it's not a fence.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///