Skip to content

Commit 08bd911

Browse files
zeertzjqchrisbra
authored andcommitted
patch 9.2.0295: 'showcmd' shows wrong Visual block size with 'linebreak'
Problem: 'showcmd' shows wrong Visual block size with 'linebreak' after end char (after 7.4.467). Solution: Exclude 'linebreak' from end position. Also fix confusing test function names. closes: #19908 Signed-off-by: zeertzjq <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 22db4a3 commit 08bd911

5 files changed

Lines changed: 26 additions & 9 deletions

File tree

src/normal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1653,7 +1653,7 @@ clear_showcmd(void)
16531653
curwin->w_p_sbr = empty_option;
16541654
#endif
16551655
getvcols(curwin, &curwin->w_cursor, &VIsual,
1656-
&leftcol, &rightcol, 0);
1656+
&leftcol, &rightcol, GETVCOL_END_EXCL_LBR);
16571657
#ifdef FEAT_LINEBREAK
16581658
p_sbr = saved_sbr;
16591659
curwin->w_p_sbr = saved_w_sbr;

src/testdir/dumps/Test_visual_block_hl_with_linebreak_1.dump

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/testdir/test_listlbr.vim

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,28 @@ func Test_linebreak_reset_restore()
195195
call StopVimInTerminal(buf)
196196
endfunc
197197

198-
func Test_virtual_block()
198+
func Test_visual_block()
199199
call s:test_windows('setl sbr=+')
200200
call setline(1, [
201201
\ "REMOVE: this not",
202202
\ "REMOVE: aaaaaaaaaaaaa",
203203
\ ])
204+
set showcmd showcmdloc=tabline showtabline=2 tabline=%S
205+
if has('gui')
206+
set guioptions-=e
207+
endif
204208
exe "norm! 1/^REMOVE:"
205-
exe "norm! 0\<C-V>jf x"
209+
exe "norm! 0\<C-V>jf "
210+
let lines = s:screen_lines([1, 4], winwidth(0))
211+
let expect = [
212+
\ "2x8 ",
213+
\ "REMOVE: this not ",
214+
\ "REMOVE: ",
215+
\ "+aaaaaaaaaaaaa ",
216+
\ ]
217+
call s:compare_lines(expect, lines)
218+
norm! x
219+
set showcmd& showcmdloc& showtabline& tabline& guioptions&
206220
$put
207221
let lines = s:screen_lines([1, 4], winwidth(0))
208222
let expect = [
@@ -215,7 +229,7 @@ func Test_virtual_block()
215229
call s:close_windows()
216230
endfunc
217231

218-
func Test_virtual_block_and_vbA()
232+
func Test_visual_block_and_vbA()
219233
call s:test_windows()
220234
call setline(1, "long line: " . repeat("foobar ", 40) . "TARGET at end")
221235
exe "norm! $3B\<C-v>eAx\<Esc>"
@@ -236,7 +250,7 @@ func Test_virtual_block_and_vbA()
236250
call s:close_windows()
237251
endfunc
238252

239-
func Test_virtual_char_and_block()
253+
func Test_visual_char_and_block()
240254
call s:test_windows()
241255
call setline(1, "1111-1111-1111-11-1111-1111-1111")
242256
exe "norm! 0f-lv3lc2222\<Esc>bgj."

src/testdir/test_listlbr_utf8.vim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,11 +412,12 @@ func Test_visual_block_hl_with_linebreak()
412412
setlocal nolinebreak
413413
call setline(1, [repeat('x', 15), repeat('x', 10), repeat('x', 10)])
414414
call prop_type_add('test', {})
415-
call prop_add(2, 5, #{text: "foo: ",type: "test"})
416-
call prop_add(3, 5, #{text: "bar: ",type: "test"})
415+
call prop_add(2, 5, #{text: "foo: ", type: "test"})
416+
call prop_add(3, 5, #{text: "bar: ", type: "test"})
417417
exe "normal! gg02l\<C-V>2j2l"
418418
endfunc
419419

420+
set laststatus=0 showcmd ruler
420421
" FIXME: clipboard=autoselect sometimes changes Visual highlight
421422
set clipboard=
422423
END

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ static char *(features[]) =
734734

735735
static int included_patches[] =
736736
{ /* Add new patch number below this line */
737+
/**/
738+
295,
737739
/**/
738740
294,
739741
/**/

0 commit comments

Comments
 (0)