summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0327
blob: 37cdd65d7882ee6851ebbb4268180fc0fbf0116e (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0327
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.0327
Problem:    The "g CTRL-G" command isn't tested much.
Solution:   Add more tests. (Dominique Pelle, closes #3369)
Files:	    src/testdir/test_normal.vim


*** ../vim-8.1.0326/src/testdir/test_normal.vim	2018-05-17 15:43:28.000000000 +0200
--- src/testdir/test_normal.vim	2018-08-24 21:56:40.272464401 +0200
***************
*** 1806,1816 ****
    call assert_equal(15, col('.'))
    call assert_equal('l', getreg(0))
  
-   " Test for g Ctrl-G
-   set ff=unix
-   let a=execute(":norm! g\<c-g>")
-   call assert_match('Col 15 of 43; Line 2 of 2; Word 2 of 2; Byte 16 of 45', a)
- 
    " Test for gI
    norm! gIfoo
    call assert_equal(['', 'fooabcdefghijk   lmno0123456789AMNOPQRSTUVWXYZ'], getline(1,'$'))
--- 1806,1811 ----
***************
*** 1829,1834 ****
--- 1824,1904 ----
    bw!
  endfunc
  
+ func! Test_g_ctrl_g()
+   new
+ 
+   let a = execute(":norm! g\<c-g>")
+   call assert_equal("\n--No lines in buffer--", a)
+ 
+   call setline(1, ['first line', 'second line'])
+ 
+   " Test g CTRL-g with dos, mac and unix file type.
+   norm! gojll
+   set ff=dos
+   let a = execute(":norm! g\<c-g>")
+   call assert_equal("\nCol 3 of 11; Line 2 of 2; Word 3 of 4; Byte 15 of 25", a)
+ 
+   set ff=mac
+   let a = execute(":norm! g\<c-g>")
+   call assert_equal("\nCol 3 of 11; Line 2 of 2; Word 3 of 4; Byte 14 of 23", a)
+ 
+   set ff=unix
+   let a = execute(":norm! g\<c-g>")
+   call assert_equal("\nCol 3 of 11; Line 2 of 2; Word 3 of 4; Byte 14 of 23", a)
+ 
+   " Test g CTRL-g in visual mode (v)
+   let a = execute(":norm! gojllvlg\<c-g>")
+   call assert_equal("\nSelected 1 of 2 Lines; 1 of 4 Words; 2 of 23 Bytes", a)
+ 
+   " Test g CTRL-g in visual mode (CTRL-V) with end col > start col
+   let a = execute(":norm! \<Esc>gojll\<C-V>kllg\<c-g>")
+   call assert_equal("\nSelected 3 Cols; 2 of 2 Lines; 2 of 4 Words; 6 of 23 Bytes", a)
+ 
+   " Test g_CTRL-g in visual mode (CTRL-V) with end col < start col
+   let a = execute(":norm! \<Esc>goll\<C-V>jhhg\<c-g>")
+   call assert_equal("\nSelected 3 Cols; 2 of 2 Lines; 2 of 4 Words; 6 of 23 Bytes", a)
+ 
+   " Test g CTRL-g in visual mode (CTRL-V) with end_vcol being MAXCOL
+   let a = execute(":norm! \<Esc>gojll\<C-V>k$g\<c-g>")
+   call assert_equal("\nSelected 2 of 2 Lines; 4 of 4 Words; 17 of 23 Bytes", a)
+ 
+   " There should be one byte less with noeol
+   set bin noeol
+   let a = execute(":norm! \<Esc>gog\<c-g>")
+   call assert_equal("\nCol 1 of 10; Line 1 of 2; Word 1 of 4; Char 1 of 23; Byte 1 of 22", a)
+   set bin & eol&
+ 
+   if has('multi_byte')
+     call setline(1, ['Français', '日本語'])
+ 
+     let a = execute(":norm! \<Esc>gojlg\<c-g>")
+     call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20", a)
+ 
+     let a = execute(":norm! \<Esc>gojvlg\<c-g>")
+     call assert_equal("\nSelected 1 of 2 Lines; 1 of 2 Words; 2 of 13 Chars; 6 of 20 Bytes", a)
+ 
+     let a = execute(":norm! \<Esc>goll\<c-v>jlg\<c-g>")
+     call assert_equal("\nSelected 4 Cols; 2 of 2 Lines; 2 of 2 Words; 6 of 13 Chars; 11 of 20 Bytes", a)
+ 
+     set fenc=utf8 bomb
+     let a = execute(":norm! \<Esc>gojlg\<c-g>")
+     call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20(+3 for BOM)", a)
+ 
+     set fenc=utf16 bomb
+     let a = execute(":norm! g\<c-g>")
+     call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20(+2 for BOM)", a)
+ 
+     set fenc=utf32 bomb
+     let a = execute(":norm! g\<c-g>")
+     call assert_equal("\nCol 4-3 of 9-6; Line 2 of 2; Word 2 of 2; Char 11 of 13; Byte 16 of 20(+4 for BOM)", a)
+ 
+     set fenc& bomb&
+   endif
+ 
+   set ff&
+   bwipe!
+ endfunc
+ 
  fun! Test_normal34_g_cmd3()
    if !has("multi_byte")
      return
*** ../vim-8.1.0326/src/version.c	2018-08-24 21:30:24.818557489 +0200
--- src/version.c	2018-08-24 21:57:46.239693505 +0200
***************
*** 796,797 ****
--- 796,799 ----
  {   /* Add new patch number below this line */
+ /**/
+     327,
  /**/

-- 
For large projects, Team Leaders use sophisticated project management software
to keep track of who's doing what.  The software collects the lies and guesses
of the project team and organizes them in to instantly outdated charts that
are too boring to look at closely.  This is called "planning".
				(Scott Adams - The Dilbert principle)

 /// 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    ///