To: vim_dev@googlegroups.com Subject: Patch 9.0.0210 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0210 Problem: 'list' mode does not work properly with virtual text. Solution: Show the "$" at the right position. (closes #10913) Files: src/drawline.c, src/charset.c, src/testdir/test_textprop.vim, src/testdir/dumps/Test_prop_insert_list_mode_1.dump, src/testdir/dumps/Test_prop_insert_list_mode_2.dump, src/testdir/dumps/Test_prop_insert_list_mode_3.dump *** ../vim-9.0.0209/src/drawline.c 2022-08-14 16:50:39.016238231 +0100 --- src/drawline.c 2022-08-14 19:32:30.911965273 +0100 *************** *** 1640,1645 **** --- 1640,1652 ---- : bcol >= text_props[text_prop_next].tp_col - 1)) { if (text_props[text_prop_next].tp_col == MAXCOL + && *ptr == NUL && wp->w_p_list && lcs_eol_one > 0) + { + // first display the '$' after the line + text_prop_follows = TRUE; + break; + } + if (text_props[text_prop_next].tp_col == MAXCOL || bcol <= text_props[text_prop_next].tp_col - 1 + text_props[text_prop_next].tp_len) text_prop_idxs[text_props_active++] = text_prop_next; *************** *** 1755,1760 **** --- 1762,1777 ---- ? wlv.col == 0 || !wp->w_p_wrap : n_used < wlv.n_extra)) added = 0; + + // With 'nowrap' add one to show the + // "extends" character if needed (it + // doesn't show it the text just fits). + if (!wp->w_p_wrap + && n_used < wlv.n_extra + && wp->w_lcs_chars.ext != NUL + && wp->w_p_list) + ++n_used; + // add 1 for NUL, 2 for when '…' is used l = alloc(n_used + added + 3); if (l != NULL) *************** *** 2728,2743 **** { // In virtualedit, visual selections may extend // beyond end of line. ! if (area_highlighting && virtual_active() ! && tocol != MAXCOL && wlv.vcol < tocol) ! wlv.n_extra = 0; ! else ! { wlv.p_extra = at_end_str; ! wlv.n_extra = 1; ! wlv.c_extra = NUL; ! wlv.c_final = NUL; ! } } if (wp->w_p_list && wp->w_lcs_chars.eol > 0) c = wp->w_lcs_chars.eol; --- 2745,2754 ---- { // In virtualedit, visual selections may extend // beyond end of line. ! if (!(area_highlighting && virtual_active() ! && tocol != MAXCOL && wlv.vcol < tocol)) wlv.p_extra = at_end_str; ! wlv.n_extra = 0; } if (wp->w_p_list && wp->w_lcs_chars.eol > 0) c = wp->w_lcs_chars.eol; *************** *** 3218,3225 **** #endif wlv.col == wp->w_width - 1) && (*ptr != NUL ! || (wp->w_p_list && lcs_eol_one > 0) ! || (wlv.n_extra && (wlv.c_extra != NUL || *wlv.p_extra != NUL)))) { c = wp->w_lcs_chars.ext; --- 3229,3236 ---- #endif wlv.col == wp->w_width - 1) && (*ptr != NUL ! || lcs_eol_one > 0 ! || (wlv.n_extra > 0 && (wlv.c_extra != NUL || *wlv.p_extra != NUL)))) { c = wp->w_lcs_chars.ext; *** ../vim-9.0.0209/src/charset.c 2022-08-14 13:28:36.223224725 +0100 --- src/charset.c 2022-08-14 19:09:01.117048599 +0100 *************** *** 1186,1191 **** --- 1186,1196 ---- int len = (int)STRLEN(p); int n_used = len; + // The "$" for 'list' mode will go between the EOL and + // the text prop, account for that. + if (wp->w_p_list && wp->w_lcs_chars.eol != NUL) + ++vcol; + // Keep in sync with where textprop_size_after_trunc() // is called in win_line(). if (!wrap) *** ../vim-9.0.0209/src/testdir/test_textprop.vim 2022-08-14 16:36:16.674056502 +0100 --- src/testdir/test_textprop.vim 2022-08-14 19:34:49.203850417 +0100 *************** *** 2969,2972 **** --- 2969,3002 ---- call delete('XscriptPropsStartIncl') endfunc + func Test_insert_text_list_mode() + CheckRunVimInTerminal + + let lines =<< trim END + vim9script + setline(1, ['This is a line with quite a bit of text here.', + 'second line', 'third line']) + set list listchars+=extends:» + prop_type_add('Prop1', {highlight: 'Error'}) + prop_add(1, 0, { + type: 'Prop1', + text: 'The quick brown fox jumps over the lazy dog', + text_align: 'right' + }) + END + call writefile(lines, 'XscriptPropsListMode') + let buf = RunVimInTerminal('-S XscriptPropsListMode', #{rows: 8, cols: 60}) + call term_sendkeys(buf, "ggj") + call VerifyScreenDump(buf, 'Test_prop_insert_list_mode_1', {}) + + call term_sendkeys(buf, ":set nowrap\") + call VerifyScreenDump(buf, 'Test_prop_insert_list_mode_2', {}) + + call term_sendkeys(buf, "ggd32l") + call VerifyScreenDump(buf, 'Test_prop_insert_list_mode_3', {}) + + call StopVimInTerminal(buf) + call delete('XscriptPropsListMode') + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-9.0.0209/src/testdir/dumps/Test_prop_insert_list_mode_1.dump 2022-08-14 19:36:40.195760255 +0100 --- src/testdir/dumps/Test_prop_insert_list_mode_1.dump 2022-08-14 19:34:51.703848367 +0100 *************** *** 0 **** --- 1,8 ---- + |T+0&#ffffff0|h|i|s| |i|s| |a| |l|i|n|e| |w|i|t|h| |q|u|i|t|e| |a| |b|i|t| |o|f| |t|e|x|t| |h|e|r|e|.|$+0#4040ff13&|T+0#ffffff16#ff404010|h|e| |q|u|i|c|k| |b|r|o|… + >s+0#0000000#ffffff0|e|c|o|n|d| |l|i|n|e|$+0#4040ff13&| +0#0000000&@47 + |t|h|i|r|d| |l|i|n|e|$+0#4040ff13&| +0#0000000&@48 + |~+0#4040ff13&| @58 + |~| @58 + |~| @58 + |~| @58 + | +0#0000000&@41|2|,|1| @10|A|l@1| *** ../vim-9.0.0209/src/testdir/dumps/Test_prop_insert_list_mode_2.dump 2022-08-14 19:36:40.199760252 +0100 --- src/testdir/dumps/Test_prop_insert_list_mode_2.dump 2022-08-14 19:34:52.855847425 +0100 *************** *** 0 **** --- 1,8 ---- + |T+0&#ffffff0|h|i|s| |i|s| |a| |l|i|n|e| |w|i|t|h| |q|u|i|t|e| |a| |b|i|t| |o|f| |t|e|x|t| |h|e|r|e|.|$+0#4040ff13&|T+0#ffffff16#ff404010|h|e| |q|u|i|c|k| |b|r|o|»+0#4040ff13#ffffff0 + >s+0#0000000&|e|c|o|n|d| |l|i|n|e|$+0#4040ff13&| +0#0000000&@47 + |t|h|i|r|d| |l|i|n|e|$+0#4040ff13&| +0#0000000&@48 + |~+0#4040ff13&| @58 + |~| @58 + |~| @58 + |~| @58 + |:+0#0000000&|s|e|t| |n|o|w|r|a|p| @30|2|,|1| @10|A|l@1| *** ../vim-9.0.0209/src/testdir/dumps/Test_prop_insert_list_mode_3.dump 2022-08-14 19:36:40.203760248 +0100 --- src/testdir/dumps/Test_prop_insert_list_mode_3.dump 2022-08-14 19:34:54.003846485 +0100 *************** *** 0 **** --- 1,8 ---- + >o+0&#ffffff0|f| |t|e|x|t| |h|e|r|e|.|$+0#4040ff13&| +0#0000000&@2|T+0#ffffff16#ff404010|h|e| |q|u|i|c|k| |b|r|o|w|n| |f|o|x| |j|u|m|p|s| |o|v|e|r| |t|h|e| |l|a|z|y| |d|o|g + |s+0#0000000#ffffff0|e|c|o|n|d| |l|i|n|e|$+0#4040ff13&| +0#0000000&@47 + |t|h|i|r|d| |l|i|n|e|$+0#4040ff13&| +0#0000000&@48 + |~+0#4040ff13&| @58 + |~| @58 + |~| @58 + |~| @58 + |:+0#0000000&|s|e|t| |n|o|w|r|a|p| @30|1|,|1| @10|A|l@1| *** ../vim-9.0.0209/src/version.c 2022-08-14 16:50:39.016238231 +0100 --- src/version.c 2022-08-14 18:20:23.001065150 +0100 *************** *** 737,738 **** --- 737,740 ---- { /* Add new patch number below this line */ + /**/ + 210, /**/ -- [clop clop] GUARD #1: Halt! Who goes there? ARTHUR: It is I, Arthur, son of Uther Pendragon, from the castle of Camelot. King of the Britons, defeator of the Saxons, sovereign of all England! GUARD #1: Pull the other one! The Quest for the Holy Grail (Monty Python) /// 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 ///