Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion runtime/doc/textprop.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ prop_add({lnum}, {col}, {props})
When omitted "truncate" is used.
Note that this applies to the individual text
property, the 'wrap' option sets the overall
behavior
behavior. "wrap" only takes effect when the
'wrap' option is set; with 'nowrap' the text
is truncated at the right edge of the window.
All fields except "type" are optional.

It is an error when both "length" and "end_lnum" or "end_col"
Expand Down
6 changes: 5 additions & 1 deletion src/drawline.c
Original file line number Diff line number Diff line change
Expand Up @@ -2479,7 +2479,11 @@ win_line(
// displaying that character.
// Or when not wrapping and at the rightmost column.

int only_below_follows = !wp->w_p_wrap && wlv.col == wp->w_width - 1;
// Use the displayed width so a double-width or <Tab> last
// character filling the rightmost column is detected too.
int only_below_follows = !wp->w_p_wrap
&& wlv.col + win_chartabsize(wp, ptr, wlv.vcol)
>= wp->w_width;
int suffix_flags = text_prop_suffix_flags[text_prop_next];

text_prop_follows = (suffix_flags
Expand Down
8 changes: 8 additions & 0 deletions src/testdir/dumps/Test_prop_with_text_after_wide_char_1.dump

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/testdir/dumps/Test_prop_with_text_after_wide_char_2.dump

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions src/testdir/test_textprop.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3574,6 +3574,56 @@ func Test_props_with_text_after_nowrap()
call StopVimInTerminal(buf)
endfunc

func Test_props_with_text_after_wide_char_at_end()
CheckScreendump
CheckRunVimInTerminal

" The buffer line ends with a double-width character exactly at the window
" width and has wrapping "after" virtual text. This must not leave blank
" lines or "@@@", see issue #20384.
let lines =<< trim END
vim9script
set nowrap
setline(1, [repeat('x', 43) .. '口', 'second line', 'third line'])
prop_type_add('errtype', {highlight: 'WarningMsg', text_wrap: 'wrap'})
prop_add(1, 0, {type: 'errtype', text_padding_left: 3, text: 'E>'})
END
call writefile(lines, 'XscriptPropsAfterWideChar', 'D')
let buf = RunVimInTerminal('-S XscriptPropsAfterWideChar', #{rows: 8, cols: 45})
call VerifyScreenDump(buf, 'Test_prop_with_text_after_wide_char_1', {})

call StopVimInTerminal(buf)
endfunc

func Test_props_with_text_after_wide_char_overflow()
CheckScreendump
CheckRunVimInTerminal

" Like above, but the last character reaches the rightmost column without
" starting on it: a double-width character that does not fit in the last
" column, and a <Tab> that expands up to the window width. Both must be
" detected as filling the line so the wrapping "after" text does not cause
" blank lines, "@@@" or a spurious wrap with 'nowrap'.
let lines =<< trim END
vim9script
set nowrap tabstop=8 noexpandtab
setline(1, [
repeat('x', 39) .. '口',
'between line',
repeat('x', 32) .. "\t",
'last line',
])
prop_type_add('errtype', {highlight: 'WarningMsg', text_wrap: 'wrap'})
prop_add(1, 0, {type: 'errtype', text_padding_left: 3, text: 'E>'})
prop_add(3, 0, {type: 'errtype', text_padding_left: 3, text: 'E>'})
END
call writefile(lines, 'XscriptPropsAfterWideOverflow', 'D')
let buf = RunVimInTerminal('-S XscriptPropsAfterWideOverflow', #{rows: 8, cols: 40})
call VerifyScreenDump(buf, 'Test_prop_with_text_after_wide_char_2', {})

call StopVimInTerminal(buf)
endfunc

func Test_prop_with_text_below_cul()
CheckScreendump
CheckRunVimInTerminal
Expand Down
Loading