Patch 8.2.2904

6 views
Skip to first unread message

Bram Moolenaar

unread,
May 29, 2021, 1:18:35 PM5/29/21
to vim...@googlegroups.com

Patch 8.2.2904
Problem: "g$" causes scroll if half a double width char is visible.
Solution: Advance to the last fully visible character. (closes #8254)
Files: src/normal.c, src/testdir/test_normal.vim


*** ../vim-8.2.2903/src/normal.c 2021-05-04 21:56:24.877671364 +0200
--- src/normal.c 2021-05-29 19:17:12.752383426 +0200
***************
*** 6144,6149 ****
--- 6144,6160 ----
i = curwin->w_leftcol + curwin->w_width - col_off - 1;
coladvance((colnr_T)i);

+ // if the character doesn't fit move one back
+ if (curwin->w_cursor.col > 0
+ && (*mb_ptr2cells)(ml_get_cursor()) > 1)
+ {
+ colnr_T vcol;
+
+ getvvcol(curwin, &curwin->w_cursor, NULL, NULL, &vcol);
+ if (vcol >= curwin->w_leftcol + curwin->w_width - col_off)
+ --curwin->w_cursor.col;
+ }
+
// Make sure we stick in this column.
validate_virtcol();
curwin->w_curswant = curwin->w_virtcol;
*** ../vim-8.2.2903/src/testdir/test_normal.vim 2021-05-29 16:30:08.674611431 +0200
--- src/testdir/test_normal.vim 2021-05-29 19:14:13.020819768 +0200
***************
*** 2201,2209 ****
%d
15vsp
set wrap listchars= sbr=
! let lineA='abcdefghijklmnopqrstuvwxyz'
! let lineB='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
! let lineC='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
$put =lineA
$put =lineB

--- 2201,2209 ----
%d
15vsp
set wrap listchars= sbr=
! let lineA = 'abcdefghijklmnopqrstuvwxyz'
! let lineB = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
! let lineC = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
$put =lineA
$put =lineB

***************
*** 2238,2243 ****
--- 2238,2265 ----
call assert_equal('l', getreg(0))
call assert_beeps('normal 5g$')

+ " Test for g$ with double-width character half displayed
+ vsplit
+ 9wincmd |
+ setlocal nowrap nonumber
+ call setline(2, 'asdfasdfヨ')
+ 2
+ normal 0g$
+ call assert_equal(8, col('.'))
+ 10wincmd |
+ normal 0g$
+ call assert_equal(9, col('.'))
+
+ setlocal signcolumn=yes
+ 11wincmd |
+ normal 0g$
+ call assert_equal(8, col('.'))
+ 12wincmd |
+ normal 0g$
+ call assert_equal(9, col('.'))
+
+ close
+
" Test for g_
call assert_beeps('normal! 100g_')
call setline(2, [' foo ', ' foobar '])
*** ../vim-8.2.2903/src/version.c 2021-05-29 17:56:33.833094008 +0200
--- src/version.c 2021-05-29 19:03:39.530491760 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2904,
/**/

--
ARTHUR: Ni!
BEDEVERE: Nu!
ARTHUR: No. Ni! More like this. "Ni"!
BEDEVERE: Ni, ni, ni!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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