diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-01-14 20:11:38 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-14 20:11:38 +0000 |
commit | 0f112052acaeffd75b7eb001eeb8a246ad12a276 (patch) | |
tree | a17f77f9a69ce3771d2c7c2c9e61c7c48d4c5d78 /src | |
parent | 26ebf1f036517ebeacf571c333a83cca7e13bbe2 (diff) |
patch 8.2.4091: virtcol is recomputed for statusline unnecessarilyv8.2.4091
Problem: Virtcol is recomputed for statusline unnecessarily.
Solution: Just use "w_virtcol". (closes #9523)
Diffstat (limited to 'src')
-rw-r--r-- | src/buffer.c | 10 | ||||
-rw-r--r-- | src/testdir/test_statusline.vim | 9 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 12 insertions, 9 deletions
diff --git a/src/buffer.c b/src/buffer.c index 3445b204f3..08db0fc28e 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -4610,15 +4610,7 @@ build_stl_str_hl( case STL_VIRTCOL: case STL_VIRTCOL_ALT: - // In list mode virtcol needs to be recomputed - virtcol = wp->w_virtcol; - if (wp->w_p_list && wp->w_lcs_chars.tab1 == NUL) - { - wp->w_p_list = FALSE; - getvcol(wp, &wp->w_cursor, NULL, &virtcol, NULL); - wp->w_p_list = TRUE; - } - ++virtcol; + virtcol = wp->w_virtcol + 1; // Don't display %V if it's the same as %c. if (opt == STL_VIRTCOL_ALT && (virtcol == (colnr_T)(!(State & INSERT) && empty_line diff --git a/src/testdir/test_statusline.vim b/src/testdir/test_statusline.vim index a952de69b9..28d8798fe8 100644 --- a/src/testdir/test_statusline.vim +++ b/src/testdir/test_statusline.vim @@ -196,7 +196,16 @@ func Test_statusline() set virtualedit=all norm 10| call assert_match('^10,-10\s*$', s:get_statusline()) + set list + call assert_match('^10,-10\s*$', s:get_statusline()) set virtualedit& + exe "norm A\<Tab>\<Tab>a\<Esc>" + " In list mode a <Tab> is shown as "^I", which is 2-wide. + call assert_match('^9,-9\s*$', s:get_statusline()) + set list& + " Now the second <Tab> ends at the 16th screen column. + call assert_match('^17,-17\s*$', s:get_statusline()) + undo " %w: Preview window flag, text is "[Preview]". " %W: Preview window flag, text is ",PRV". diff --git a/src/version.c b/src/version.c index b65dac3c59..525c86a764 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4091, +/**/ 4090, /**/ 4089, |