summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0739
blob: b31a6f1074c6170b5c88cf4f278eeb96cb30f630 (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
137
138
139
140
141
142
143
144
145
146
147
148
149
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0739
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.0739
Problem:    Text objects in not sufficiently tested.
Solution:   Add a few more test cases. (Dominique Pelle, closes #3795)
Files:	    src/testdir/test_visual.vim


*** ../vim-8.1.0738/src/testdir/test_visual.vim	2019-01-03 23:10:28.338798991 +0100
--- src/testdir/test_visual.vim	2019-01-13 16:12:12.572650446 +0100
***************
*** 274,282 ****
    set bs&vim
  endfunc
  
  func Test_Visual_sentence_textobject()
    new
!   call setline(1, ['First sentence. Second sentence. Third', 'sentence. Fouth sentence'])
  
    " When start and end of visual area are identical, 'as' or 'is' select
    " the whole sentence.
--- 274,319 ----
    set bs&vim
  endfunc
  
+ func Test_Visual_word_textobject()
+   new
+   call setline(1, ['First sentence. Second sentence.'])
+ 
+   " When start and end of visual area are identical, 'aw' or 'iw' select
+   " the whole word.
+   norm! 1go2fcvawy
+   call assert_equal('Second ', @")
+   norm! 1go2fcviwy
+   call assert_equal('Second', @")
+ 
+   " When start and end of visual area are not identical, 'aw' or 'iw'
+   " extend the word in direction of the end of the visual area.
+   norm! 1go2fcvlawy
+   call assert_equal('cond ', @")
+   norm! gv2awy
+   call assert_equal('cond sentence.', @")
+ 
+   norm! 1go2fcvliwy
+   call assert_equal('cond', @")
+   norm! gv2iwy
+   call assert_equal('cond sentence', @")
+ 
+   " Extend visual area in opposite direction.
+   norm! 1go2fcvhawy
+   call assert_equal(' Sec', @")
+   norm! gv2awy
+   call assert_equal(' sentence. Sec', @")
+ 
+   norm! 1go2fcvhiwy
+   call assert_equal('Sec', @")
+   norm! gv2iwy
+   call assert_equal('. Sec', @")
+ 
+   bwipe!
+ endfunc
+ 
  func Test_Visual_sentence_textobject()
    new
!   call setline(1, ['First sentence. Second sentence. Third', 'sentence. Fourth sentence'])
  
    " When start and end of visual area are identical, 'as' or 'is' select
    " the whole sentence.
***************
*** 314,316 ****
--- 351,402 ----
  
    bwipe!
  endfunc
+ 
+ func Test_Visual_paragraph_textobject()
+   new
+   call setline(1, ['First line.',
+   \                '',
+   \                'Second line.',
+   \                'Third line.',
+   \                'Fourth line.',
+   \                'Fifth line.',
+   \                '',
+   \                'Sixth line.'])
+ 
+   " When start and end of visual area are identical, 'ap' or 'ip' select
+   " the whole paragraph.
+   norm! 4ggvapy
+   call assert_equal("Second line.\nThird line.\nFourth line.\nFifth line.\n\n", @")
+   norm! 4ggvipy
+   call assert_equal("Second line.\nThird line.\nFourth line.\nFifth line.\n", @")
+ 
+   " When start and end of visual area are not identical, 'ap' or 'ip'
+   " extend the sentence in direction of the end of the visual area.
+   " FIXME: actually, it is not sufficient to have different start and
+   " end of visual selection, the start line and end line have to differ,
+   " which is not consistent with the documentation.
+   norm! 4ggVjapy
+   call assert_equal("Third line.\nFourth line.\nFifth line.\n\n", @")
+   norm! gvapy
+   call assert_equal("Third line.\nFourth line.\nFifth line.\n\nSixth line.\n", @")
+   norm! 4ggVjipy
+   call assert_equal("Third line.\nFourth line.\nFifth line.\n", @")
+   norm! gvipy
+   call assert_equal("Third line.\nFourth line.\nFifth line.\n\n", @")
+   norm! gvipy
+   call assert_equal("Third line.\nFourth line.\nFifth line.\n\nSixth line.\n", @")
+ 
+   " Extend visual area in opposite direction.
+   norm! 5ggVkapy
+   call assert_equal("\nSecond line.\nThird line.\nFourth line.\n", @")
+   norm! gvapy
+   call assert_equal("First line.\n\nSecond line.\nThird line.\nFourth line.\n", @")
+   norm! 5ggVkipy
+   call assert_equal("Second line.\nThird line.\nFourth line.\n", @")
+   norma gvipy
+   call assert_equal("\nSecond line.\nThird line.\nFourth line.\n", @")
+   norm! gvipy
+   call assert_equal("First line.\n\nSecond line.\nThird line.\nFourth line.\n", @")
+ 
+   bwipe!
+ endfunc
*** ../vim-8.1.0738/src/version.c	2019-01-13 16:07:17.522749372 +0100
--- src/version.c	2019-01-13 16:10:15.469483193 +0100
***************
*** 797,798 ****
--- 797,800 ----
  {   /* Add new patch number below this line */
+ /**/
+     739,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
187. You promise yourself that you'll only stay online for another
     15 minutes...at least once every hour.

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