• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revision8f1f4f6c87ad28ee5971a549f50c357ba9491375 (tree)
Time2022-01-15 05:15:04
AuthorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

patch 8.2.4091: virtcol is recomputed for statusline unnecessarily

Commit: https://github.com/vim/vim/commit/0f112052acaeffd75b7eb001eeb8a246ad12a276
Author: zeertzjq <zeertzjq@outlook.com>
Date: Fri Jan 14 20:11:38 2022 +0000

patch 8.2.4091: virtcol is recomputed for statusline unnecessarily
Problem: Virtcol is recomputed for statusline unnecessarily.
Solution: Just use "w_virtcol". (closes https://github.com/vim/vim/issues/9523)

Change Summary

Incremental Difference

diff -r ba99046fbbc4 -r 8f1f4f6c87ad src/buffer.c
--- a/src/buffer.c Fri Jan 14 14:30:03 2022 +0100
+++ b/src/buffer.c Fri Jan 14 21:15:04 2022 +0100
@@ -4610,15 +4610,7 @@
46104610
46114611 case STL_VIRTCOL:
46124612 case STL_VIRTCOL_ALT:
4613- // In list mode virtcol needs to be recomputed
4614- virtcol = wp->w_virtcol;
4615- if (wp->w_p_list && wp->w_lcs_chars.tab1 == NUL)
4616- {
4617- wp->w_p_list = FALSE;
4618- getvcol(wp, &wp->w_cursor, NULL, &virtcol, NULL);
4619- wp->w_p_list = TRUE;
4620- }
4621- ++virtcol;
4613+ virtcol = wp->w_virtcol + 1;
46224614 // Don't display %V if it's the same as %c.
46234615 if (opt == STL_VIRTCOL_ALT
46244616 && (virtcol == (colnr_T)(!(State & INSERT) && empty_line
diff -r ba99046fbbc4 -r 8f1f4f6c87ad src/testdir/test_statusline.vim
--- a/src/testdir/test_statusline.vim Fri Jan 14 14:30:03 2022 +0100
+++ b/src/testdir/test_statusline.vim Fri Jan 14 21:15:04 2022 +0100
@@ -196,7 +196,16 @@
196196 set virtualedit=all
197197 norm 10|
198198 call assert_match('^10,-10\s*$', s:get_statusline())
199+ set list
200+ call assert_match('^10,-10\s*$', s:get_statusline())
199201 set virtualedit&
202+ exe "norm A\<Tab>\<Tab>a\<Esc>"
203+ " In list mode a <Tab> is shown as "^I", which is 2-wide.
204+ call assert_match('^9,-9\s*$', s:get_statusline())
205+ set list&
206+ " Now the second <Tab> ends at the 16th screen column.
207+ call assert_match('^17,-17\s*$', s:get_statusline())
208+ undo
200209
201210 " %w: Preview window flag, text is "[Preview]".
202211 " %W: Preview window flag, text is ",PRV".
diff -r ba99046fbbc4 -r 8f1f4f6c87ad src/version.c
--- a/src/version.c Fri Jan 14 14:30:03 2022 +0100
+++ b/src/version.c Fri Jan 14 21:15:04 2022 +0100
@@ -751,6 +751,8 @@
751751 static int included_patches[] =
752752 { /* Add new patch number below this line */
753753 /**/
754+ 4091,
755+/**/
754756 4090,
755757 /**/
756758 4089,
Show on old repository browser