diff options
author | Bram Moolenaar <Bram@vim.org> | 2023-02-12 14:42:15 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-02-12 14:42:15 +0000 |
commit | 234c3fab28c14846b962c90097496b27ee1b4df8 (patch) | |
tree | 58ca0242f456f6c53a9a26c8aa233cc46aec372c | |
parent | 094b8473edcc7531c942ac726dd575d95f5b622c (diff) |
patch 9.0.1304: "$" for 'list' option displayed in wrong positionv9.0.1304
Problem: "$" for 'list' option displayed in wrong position when there are
text properties.
Solution: Adjust logic for order of displayed items. (closes #11959)
-rw-r--r-- | src/drawline.c | 36 | ||||
-rw-r--r-- | src/testdir/dumps/Test_prop_above_below_empty_2.dump | 16 | ||||
-rw-r--r-- | src/testdir/test_textprop.vim | 3 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 41 insertions, 16 deletions
diff --git a/src/drawline.c b/src/drawline.c index 4328c06c53..72dff66c03 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -1945,7 +1945,6 @@ win_line( --bcol; # endif int display_text_first = FALSE; - int active_before = text_props_active; // Add any text property that starts in this column. // With 'nowrap' and not in the first screen line only "below" @@ -1963,21 +1962,6 @@ 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) - || (ptr == line - && !did_line - && (text_props[text_prop_next].tp_flags - & TP_FLAG_ALIGN_BELOW)))) - { - // first display the '$' after the line or display an - // empty line - text_prop_follows = TRUE; - if (text_props_active == active_before) - display_text_first = 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; @@ -2028,6 +2012,24 @@ win_line( | TP_FLAG_ALIGN_BELOW)) == 0 && wlv.col >= wp->w_width)) { + if (tp->tp_col == MAXCOL + && *ptr == NUL + && ((wp->w_p_list && lcs_eol_one > 0 + && (tp->tp_flags + & TP_FLAG_ALIGN_ABOVE) == 0) + || (ptr == line + && !did_line + && (tp->tp_flags + & TP_FLAG_ALIGN_BELOW)))) + { + // skip this prop, first display the '$' after + // the line or display an empty line + text_prop_follows = TRUE; + if (used_tpi < 0) + display_text_first = TRUE; + continue; + } + if (pt->pt_hl_id > 0) used_attr = syn_id2attr(pt->pt_hl_id); text_prop_type = pt; @@ -2038,6 +2040,7 @@ win_line( text_prop_flags = pt->pt_flags; text_prop_id = tp->tp_id; used_tpi = tpi; + display_text_first = FALSE; } } if (text_prop_id < 0 && used_tpi >= 0 @@ -3104,6 +3107,7 @@ win_line( } } else if (c == NUL + && wlv.n_extra == 0 && (wp->w_p_list || ((wlv.fromcol >= 0 || fromcol_prev >= 0) && wlv.tocol > wlv.vcol diff --git a/src/testdir/dumps/Test_prop_above_below_empty_2.dump b/src/testdir/dumps/Test_prop_above_below_empty_2.dump new file mode 100644 index 0000000000..3954a4b062 --- /dev/null +++ b/src/testdir/dumps/Test_prop_above_below_empty_2.dump @@ -0,0 +1,16 @@ +| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@1|1| |1+0#0000000&@7|$+0#4040ff13&| +0#0000000&@46 +| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@1|2| |$+0#4040ff13&| +0#0000000&@54 +| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@1|3| |3+0#0000000&@8|$+0#4040ff13&| +0#0000000&@45 +| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@1|4| |$+0#4040ff13&| +0#0000000&@54 +| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +| +0#af5f00255&@1|5| >5+0#0000000&@10|$+0#4040ff13&| +0#0000000&@43 +| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52 +|:|s|e|t| |l|i|s|t| @32|5|,|1|-|5|7| @7|A|l@1| diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index b628c8215d..f3d53f7f09 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -2798,6 +2798,9 @@ func Test_prop_with_text_above_below_empty() let buf = RunVimInTerminal('-S XscriptPropAboveBelowEmpty', #{rows: 16, cols: 60}) call VerifyScreenDump(buf, 'Test_prop_above_below_empty_1', {}) + call term_sendkeys(buf, ":set list\<CR>") + call VerifyScreenDump(buf, 'Test_prop_above_below_empty_2', {}) + call StopVimInTerminal(buf) endfunc diff --git a/src/version.c b/src/version.c index 470940a57c..26e8ab57c5 100644 --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1304, +/**/ 1303, /**/ 1302, |