mirror of
https://github.com/vim/vim.git
synced 2025-09-28 04:24:06 -04:00
patch 9.0.0151: a "below" aligned text property does not work with 'nowrap'
Problem: A "below" aligned text property does not work with 'nowrap'. Solution: Start a new screen line to display the virtual text. (closes #10851)
This commit is contained in:
740
src/drawline.c
740
src/drawline.c
File diff suppressed because it is too large
Load Diff
14
src/misc1.c
14
src/misc1.c
@@ -364,9 +364,6 @@ plines_win_nofill(
|
|||||||
#endif
|
#endif
|
||||||
int lines;
|
int lines;
|
||||||
|
|
||||||
if (!wp->w_p_wrap)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
if (wp->w_width == 0)
|
if (wp->w_width == 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@@ -377,7 +374,16 @@ plines_win_nofill(
|
|||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lines = plines_win_nofold(wp, lnum);
|
if (!wp->w_p_wrap)
|
||||||
|
lines = 1
|
||||||
|
#ifdef FEAT_PROP_POPUP
|
||||||
|
// add a line for each "below" aligned text property
|
||||||
|
+ prop_count_below(wp->w_buffer, lnum)
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
else
|
||||||
|
lines = plines_win_nofold(wp, lnum);
|
||||||
|
|
||||||
if (winheight > 0 && lines > wp->w_height)
|
if (winheight > 0 && lines > wp->w_height)
|
||||||
return wp->w_height;
|
return wp->w_height;
|
||||||
return lines;
|
return lines;
|
||||||
|
@@ -4,6 +4,7 @@ void f_prop_add(typval_T *argvars, typval_T *rettv);
|
|||||||
void f_prop_add_list(typval_T *argvars, typval_T *rettv);
|
void f_prop_add_list(typval_T *argvars, typval_T *rettv);
|
||||||
int prop_add_common(linenr_T start_lnum, colnr_T start_col, dict_T *dict, buf_T *default_buf, typval_T *dict_arg);
|
int prop_add_common(linenr_T start_lnum, colnr_T start_col, dict_T *dict, buf_T *default_buf, typval_T *dict_arg);
|
||||||
int get_text_props(buf_T *buf, linenr_T lnum, char_u **props, int will_change);
|
int get_text_props(buf_T *buf, linenr_T lnum, char_u **props, int will_change);
|
||||||
|
int prop_count_below(buf_T *buf, linenr_T lnum);
|
||||||
int count_props(linenr_T lnum, int only_starting, int last_line);
|
int count_props(linenr_T lnum, int only_starting, int last_line);
|
||||||
int find_visible_prop(win_T *wp, int type_id, int id, textprop_T *prop, linenr_T *found_lnum);
|
int find_visible_prop(win_T *wp, int type_id, int id, textprop_T *prop, linenr_T *found_lnum);
|
||||||
void add_text_props(linenr_T lnum, textprop_T *text_props, int text_prop_count);
|
void add_text_props(linenr_T lnum, textprop_T *text_props, int text_prop_count);
|
||||||
|
@@ -0,0 +1,8 @@
|
|||||||
|
|o+0&#ffffff0|n|e| @56
|
||||||
|
| +0#ffffff16#e000002|B|e|l|o|w| |t|h|e| |l|i|n|e| | +0#0000000#ffffff0@43
|
||||||
|
|t|w|o| @56
|
||||||
|
|a+0&#ffff4012|n|o|t|h|e|r| +0&#ffffff0@52
|
||||||
|
|O+0#ffffff16#e000002|n|e| |M|o|r|e| |H|e|r|e| +0#0000000#ffffff0@46
|
||||||
|
|t|h|r|e>e| @54
|
||||||
|
|~+0#4040ff13&| @58
|
||||||
|
| +0#0000000&@41|3|,|5| @10|A|l@1|
|
@@ -2426,6 +2426,27 @@ func Test_props_with_text_after_wraps()
|
|||||||
call delete('XscriptPropsWithTextAfterWraps')
|
call delete('XscriptPropsWithTextAfterWraps')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_props_with_text_after_nowrap()
|
||||||
|
CheckRunVimInTerminal
|
||||||
|
|
||||||
|
let lines =<< trim END
|
||||||
|
set nowrap
|
||||||
|
call setline(1, ['one', 'two', 'three'])
|
||||||
|
call prop_type_add('belowprop', #{highlight: 'ErrorMsg'})
|
||||||
|
call prop_type_add('anotherprop', #{highlight: 'Search'})
|
||||||
|
call prop_add(1, 0, #{type: 'belowprop', text: ' Below the line ', text_align: 'below'})
|
||||||
|
call prop_add(2, 0, #{type: 'anotherprop', text: 'another', text_align: 'below'})
|
||||||
|
call prop_add(2, 0, #{type: 'belowprop', text: 'One More Here', text_align: 'below'})
|
||||||
|
normal G$
|
||||||
|
END
|
||||||
|
call writefile(lines, 'XscriptPropsAfterNowrap')
|
||||||
|
let buf = RunVimInTerminal('-S XscriptPropsAfterNowrap', #{rows: 8, cols: 60})
|
||||||
|
call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_1', {})
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
call delete('XscriptPropsAfterNowrap')
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_removed_prop_with_text_cleans_up_array()
|
func Test_removed_prop_with_text_cleans_up_array()
|
||||||
new
|
new
|
||||||
call setline(1, 'some text here')
|
call setline(1, 'some text here')
|
||||||
|
@@ -594,6 +594,29 @@ get_text_props(buf_T *buf, linenr_T lnum, char_u **props, int will_change)
|
|||||||
return (int)(proplen / sizeof(textprop_T));
|
return (int)(proplen / sizeof(textprop_T));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the number of text properties with "below" alignment in line "lnum".
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
prop_count_below(buf_T *buf, linenr_T lnum)
|
||||||
|
{
|
||||||
|
char_u *props;
|
||||||
|
int count = get_text_props(buf, lnum, &props, FALSE);
|
||||||
|
int result = 0;
|
||||||
|
textprop_T prop;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (count == 0)
|
||||||
|
return 0;
|
||||||
|
for (i = 0; i < count; ++i)
|
||||||
|
{
|
||||||
|
mch_memmove(&prop, props + i * sizeof(prop), sizeof(prop));
|
||||||
|
if (prop.tp_col == MAXCOL && (prop.tp_flags & TP_FLAG_ALIGN_BELOW))
|
||||||
|
++result;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the number of text properties on line "lnum" in the current buffer.
|
* Return the number of text properties on line "lnum" in the current buffer.
|
||||||
* When "only_starting" is true only text properties starting in this line will
|
* When "only_starting" is true only text properties starting in this line will
|
||||||
|
@@ -735,6 +735,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
151,
|
||||||
/**/
|
/**/
|
||||||
150,
|
150,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user