Patch 9.0.1304

4 views
Skip to first unread message

Bram Moolenaar

unread,
Feb 12, 2023, 9:42:53 AM2/12/23
to vim...@googlegroups.com

Patch 9.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)
Files: src/drawline.c, src/testdir/test_textprop.vim,
src/testdir/dumps/Test_prop_above_below_empty_2.dump


*** ../vim-9.0.1303/src/drawline.c 2023-02-11 13:48:40.334694239 +0000
--- src/drawline.c 2023-02-12 14:41:12.224677843 +0000
***************
*** 1945,1951 ****
--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"
--- 1945,1950 ----
***************
*** 1963,1983 ****
: 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;
--- 1962,1967 ----
***************
*** 2028,2033 ****
--- 2012,2035 ----
| 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,2043 ****
--- 2040,2046 ----
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,3109 ****
--- 3107,3113 ----
}
}
else if (c == NUL
+ && wlv.n_extra == 0
&& (wp->w_p_list
|| ((wlv.fromcol >= 0 || fromcol_prev >= 0)
&& wlv.tocol > wlv.vcol
*** ../vim-9.0.1303/src/testdir/test_textprop.vim 2023-02-11 13:48:40.334694239 +0000
--- src/testdir/test_textprop.vim 2023-02-12 14:30:33.845093437 +0000
***************
*** 2798,2803 ****
--- 2798,2806 ----
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

*** ../vim-9.0.1303/src/testdir/dumps/Test_prop_above_below_empty_2.dump 2023-02-12 14:40:52.084689711 +0000
--- src/testdir/dumps/Test_prop_above_below_empty_2.dump 2023-02-12 14:30:47.345083411 +0000
***************
*** 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|
*** ../vim-9.0.1303/src/version.c 2023-02-11 19:12:53.978868891 +0000
--- src/version.c 2023-02-12 14:40:39.424697206 +0000
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1304,
/**/

--
"A clear conscience is usually the sign of a bad memory."
-- Steven Wright

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages