diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/charset.c | 5 | ||||
-rw-r--r-- | src/drawline.c | 33 | ||||
-rw-r--r-- | src/testdir/dumps/Test_prop_insert_list_mode_1.dump | 8 | ||||
-rw-r--r-- | src/testdir/dumps/Test_prop_insert_list_mode_2.dump | 8 | ||||
-rw-r--r-- | src/testdir/dumps/Test_prop_insert_list_mode_3.dump | 8 | ||||
-rw-r--r-- | src/testdir/test_textprop.vim | 30 | ||||
-rw-r--r-- | src/version.c | 2 |
7 files changed, 83 insertions, 11 deletions
diff --git a/src/charset.c b/src/charset.c index 160495222..32539bf7a 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1186,6 +1186,11 @@ win_lbr_chartabsize( 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) diff --git a/src/drawline.c b/src/drawline.c index d71c73d31..9ad6ecb94 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -1640,6 +1640,13 @@ win_line( : 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,6 +1762,16 @@ win_line( ? 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,16 +2745,10 @@ win_line( { // 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 - { + if (!(area_highlighting && virtual_active() + && tocol != MAXCOL && wlv.vcol < tocol)) wlv.p_extra = at_end_str; - wlv.n_extra = 1; - wlv.c_extra = NUL; - wlv.c_final = NUL; - } + wlv.n_extra = 0; } if (wp->w_p_list && wp->w_lcs_chars.eol > 0) c = wp->w_lcs_chars.eol; @@ -3218,8 +3229,8 @@ win_line( #endif wlv.col == wp->w_width - 1) && (*ptr != NUL - || (wp->w_p_list && lcs_eol_one > 0) - || (wlv.n_extra && (wlv.c_extra != NUL + || lcs_eol_one > 0 + || (wlv.n_extra > 0 && (wlv.c_extra != NUL || *wlv.p_extra != NUL)))) { c = wp->w_lcs_chars.ext; diff --git a/src/testdir/dumps/Test_prop_insert_list_mode_1.dump b/src/testdir/dumps/Test_prop_insert_list_mode_1.dump new file mode 100644 index 000000000..3f481d546 --- /dev/null +++ b/src/testdir/dumps/Test_prop_insert_list_mode_1.dump @@ -0,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| diff --git a/src/testdir/dumps/Test_prop_insert_list_mode_2.dump b/src/testdir/dumps/Test_prop_insert_list_mode_2.dump new file mode 100644 index 000000000..26abd8812 --- /dev/null +++ b/src/testdir/dumps/Test_prop_insert_list_mode_2.dump @@ -0,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| diff --git a/src/testdir/dumps/Test_prop_insert_list_mode_3.dump b/src/testdir/dumps/Test_prop_insert_list_mode_3.dump new file mode 100644 index 000000000..58db9f69d --- /dev/null +++ b/src/testdir/dumps/Test_prop_insert_list_mode_3.dump @@ -0,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| diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index db17e79bd..c3802103c 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -2969,4 +2969,34 @@ func Test_insert_text_start_incl() 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\<CR>") + 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 diff --git a/src/version.c b/src/version.c index 65afaf6a3..c58386b56 100644 --- a/src/version.c +++ b/src/version.c @@ -736,6 +736,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 210, +/**/ 209, /**/ 208, |