Skip to content

Commit

Permalink
fix wrong tablen with above virtual text
Browse files Browse the repository at this point in the history
  • Loading branch information
julio-b committed Mar 12, 2024
1 parent 675cbfb commit 5430683
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/charset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,9 @@ win_lbr_chartabsize(
int col = (int)(s - line);
garray_T *gap = &wp->w_buffer->b_textprop_text;

if (*s == TAB)
size = wp->w_buffer->b_p_ts;

// The "$" for 'list' mode will go between the EOL and
// the text prop, account for that.
if (has_lcs_eol)
Expand Down
4 changes: 4 additions & 0 deletions src/drawline.c
Original file line number Diff line number Diff line change
Expand Up @@ -3113,6 +3113,10 @@ win_line(
{
int tab_len = 0;
long vcol_adjusted = wlv.vcol; // removed showbreak len
#ifdef FEAT_PROP_POPUP
if (wlv.text_prop_above_count > 0)
vcol_adjusted = 0;
#endif
#ifdef FEAT_LINEBREAK
char_u *sbr = get_showbreak_value(wp);

Expand Down
8 changes: 8 additions & 0 deletions src/testdir/dumps/Test_prop_above_tablen_1.dump
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
| +0&#ffffff0@15|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@10
@16|a+0#4040ff13&|b|o|v|e| |2| +0#0000000&@10
@7> @8|o|n|e| @14
@8|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@18
@8|t|w|o| @22
|~+0#4040ff13&| @32
|~| @32
| +0#0000000&@16|1|,|1|-|7|6| @6|A|l@1|
32 changes: 32 additions & 0 deletions src/testdir/test_textprop.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3547,6 +3547,38 @@ func Test_prop_above_with_indent()
call prop_type_delete('indented')
endfunc

func Test_prop_above_tablen()
CheckRunVimInTerminal

let lines =<< trim END
vim9script
setline(1, ["\t\tone", "\ttwo"])
prop_type_add('above', {highlight: 'NonText'})
prop_add(1, 0, {
text: 'above 1',
type: 'above',
text_align: 'above',
text_padding_left: 16,
})
prop_add(1, 0, {
text: 'above 2',
type: 'above',
text_align: 'above',
text_padding_left: 16,
})
prop_add(2, 0, {
text: 'above 1',
type: 'above',
text_align: 'above',
text_padding_left: 8,
})
END
call writefile(lines, 'XscriptPropAboveTab', 'D')
let buf = RunVimInTerminal('-S XscriptPropAboveTab', #{cols: 34, rows: 8})
call VerifyScreenDump(buf, 'Test_prop_above_tablen_1', {})
call StopVimInTerminal(buf)
endfunc

func Test_prop_above_with_number()
CheckRunVimInTerminal

Expand Down

0 comments on commit 5430683

Please sign in to comment.