Patch 8.2.3095

6 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 3, 2021, 4:16:24 PM7/3/21
to vim...@googlegroups.com

Patch 8.2.3095 (after 8.2.3088)
Problem: With 'virtualedit' set to "block" block selection is wrong after
using "$". (Marco Trosi)
Solution: Compute the longest selected line. (closes #8495)
Files: src/drawscreen.c, src/testdir/test_visual.vim,
src/testdir/dumps/Test_visual_block_with_virtualedit2.dump


*** ../vim-8.2.3094/src/drawscreen.c 2021-07-03 18:04:07.380374492 +0200
--- src/drawscreen.c 2021-07-03 22:07:03.023668384 +0200
***************
*** 2009,2022 ****
ve_flags = VE_ALL;
#endif
getvcols(wp, &VIsual, &curwin->w_cursor, &fromc, &toc);
#if defined(FEAT_LINEBREAK)
ve_flags = save_ve_flags;
#endif
- ++toc;
// Highlight to the end of the line, unless 'virtualedit' has
// "block".
! if (curwin->w_curswant == MAXCOL && !(ve_flags & VE_BLOCK))
! toc = MAXCOL;

if (fromc != wp->w_old_cursor_fcol
|| toc != wp->w_old_cursor_lcol)
--- 2009,2049 ----
ve_flags = VE_ALL;
#endif
getvcols(wp, &VIsual, &curwin->w_cursor, &fromc, &toc);
+ ++toc;
#if defined(FEAT_LINEBREAK)
ve_flags = save_ve_flags;
#endif
// Highlight to the end of the line, unless 'virtualedit' has
// "block".
! if (curwin->w_curswant == MAXCOL)
! {
! if (ve_flags & VE_BLOCK)
! {
! pos_T pos;
! int cursor_above =
! curwin->w_cursor.lnum < VIsual.lnum;
!
! // Need to find the longest line.
! toc = 0;
! pos.coladd = 0;
! for (pos.lnum = curwin->w_cursor.lnum; cursor_above
! ? pos.lnum <= VIsual.lnum
! : pos.lnum >= VIsual.lnum;
! pos.lnum += cursor_above ? 1 : -1)
! {
! colnr_T t;
!
! pos.col = STRLEN(ml_get_buf(wp->w_buffer,
! pos.lnum, FALSE));
! getvvcol(wp, &pos, NULL, NULL, &t);
! if (toc < t)
! toc = t;
! }
! ++toc;
! }
! else
! toc = MAXCOL;
! }

if (fromc != wp->w_old_cursor_fcol
|| toc != wp->w_old_cursor_lcol)
*** ../vim-8.2.3094/src/testdir/test_visual.vim 2021-07-03 15:08:19.341195138 +0200
--- src/testdir/test_visual.vim 2021-07-03 22:12:27.875069731 +0200
***************
*** 1256,1261 ****
--- 1256,1264 ----
call term_sendkeys(buf, "\<C-V>gg$")
call VerifyScreenDump(buf, 'Test_visual_block_with_virtualedit', {})

+ call term_sendkeys(buf, "\<Esc>gg\<C-V>G$")
+ call VerifyScreenDump(buf, 'Test_visual_block_with_virtualedit2', {})
+
" clean up
call term_sendkeys(buf, "\<Esc>")
call StopVimInTerminal(buf)
*** ../vim-8.2.3094/src/testdir/dumps/Test_visual_block_with_virtualedit2.dump 2021-07-03 22:14:07.338876822 +0200
--- src/testdir/dumps/Test_visual_block_with_virtualedit2.dump 2021-07-03 22:12:36.983052194 +0200
***************
*** 0 ****
--- 1,8 ----
+ |a+0&#e0e0e08@5| | +0&#ffffff0@42
+ |b+0&#e0e0e08@3| @2| +0&#ffffff0@42
+ |c+0&#e0e0e08@1> +0&#ffffff0| +0&#e0e0e08@3| +0&#ffffff0@42
+ |~+0#4040ff13&| @48
+ |~| @48
+ |~| @48
+ |~| @48
+ |-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@3|3|x|3| @6|3|,|3| @10|A|l@1|
*** ../vim-8.2.3094/src/version.c 2021-07-03 21:41:35.121946816 +0200
--- src/version.c 2021-07-03 22:14:14.222863333 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3095,
/**/

--
hundred-and-one symptoms of being an internet addict:
91. It's Saturday afternoon in the middle of May and you
are on computer.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages