To: vim_dev@googlegroups.com Subject: Patch 8.2.4091 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4091 Problem: Virtcol is recomputed for statusline unnecessarily. Solution: Just use "w_virtcol". (closes #9523) Files: src/buffer.c, src/testdir/test_statusline.vim *** ../vim-8.2.4090/src/buffer.c 2022-01-08 12:41:12.200795557 +0000 --- src/buffer.c 2022-01-14 20:07:22.337166752 +0000 *************** *** 4610,4624 **** 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; // Don't display %V if it's the same as %c. if (opt == STL_VIRTCOL_ALT && (virtcol == (colnr_T)(!(State & INSERT) && empty_line --- 4610,4616 ---- case STL_VIRTCOL: case STL_VIRTCOL_ALT: ! 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 *** ../vim-8.2.4090/src/testdir/test_statusline.vim 2021-10-08 18:39:23.595208057 +0100 --- src/testdir/test_statusline.vim 2022-01-14 20:07:22.337166752 +0000 *************** *** 196,202 **** --- 196,211 ---- 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\\a\" + " In list mode a is shown as "^I", which is 2-wide. + call assert_match('^9,-9\s*$', s:get_statusline()) + set list& + " Now the second 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". *** ../vim-8.2.4090/src/version.c 2022-01-14 13:19:40.054831855 +0000 --- src/version.c 2022-01-14 20:11:17.761624745 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4091, /**/ -- LAUNCELOT leaps into SHOT with a mighty cry and runs the GUARD through and hacks him to the floor. Blood. Swashbuckling music (perhaps). LAUNCELOT races through into the castle screaming. SECOND SENTRY: Hey! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@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 ///