mirror of
https://github.com/vim/vim.git
synced 2025-07-04 23:07:33 -04:00
Merge 22903852fc9e5809c8d10f356087fe49c10cc37e into a494ce1c64a2637719a5c1339abf19ec7c48089c
This commit is contained in:
commit
bd2987c381
@ -1281,6 +1281,9 @@ win_lbr_chartabsize(
|
||||
# ifdef FEAT_PROP_POPUP
|
||||
if (cts->cts_has_prop_with_text)
|
||||
{
|
||||
if (*s == TAB)
|
||||
size = wp->w_buffer->b_p_ts;
|
||||
|
||||
int tab_size = size;
|
||||
int charlen = *s == NUL ? 1 : mb_ptr2len(s);
|
||||
int i;
|
||||
|
@ -3229,13 +3229,21 @@ win_line(
|
||||
{
|
||||
int tab_len = 0;
|
||||
long vcol_adjusted = wlv.vcol; // removed showbreak len
|
||||
#ifdef FEAT_PROP_POPUP
|
||||
// the lenght of above virtual text may add up to a number
|
||||
// that is not a multiple of 'ts', adjust here to fix the
|
||||
// calculation of tab_len
|
||||
if (wlv.text_prop_above_count > 0)
|
||||
vcol_adjusted -= (wp->w_width - win_col_off(wp))
|
||||
* wlv.text_prop_above_count % wp->w_buffer->b_p_ts;
|
||||
#endif
|
||||
#ifdef FEAT_LINEBREAK
|
||||
char_u *sbr = get_showbreak_value(wp);
|
||||
|
||||
// only adjust the tab_len, when at the first column
|
||||
// after the showbreak value was drawn
|
||||
if (*sbr != NUL && wlv.vcol == wlv.vcol_sbr && wp->w_p_wrap)
|
||||
vcol_adjusted = wlv.vcol - MB_CHARLEN(sbr);
|
||||
if (*sbr != NUL && vcol_adjusted == wlv.vcol_sbr && wp->w_p_wrap)
|
||||
vcol_adjusted -= MB_CHARLEN(sbr);
|
||||
#endif
|
||||
// tab amount depends on current column
|
||||
#ifdef FEAT_VARTABS
|
||||
|
11
src/testdir/dumps/Test_prop_above_tablen_1.dump
Normal file
11
src/testdir/dumps/Test_prop_above_tablen_1.dump
Normal file
@ -0,0 +1,11 @@
|
||||
| +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
|
||||
|<+0#0000e05&|-@5|>|<|-@5|>>o+0#0000000&|n|e| @14
|
||||
@8|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@18
|
||||
|<+0#0000e05&|-@5|>|t+0#0000000&|w|o| @22
|
||||
@8|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@18
|
||||
@3|<+0#0000e05&|-@2|>|3+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e| |t|h|r|e@1|<+0#0000e05&|-@3|>|*+0#0000000&|<+0#0000e05&
|
||||
|-@4|>|l+0#0000000&|i|n|e|<+0#0000e05&|-@1|>|t+0#0000000&|h|r|e@1| @14
|
||||
@3|<+0#0000e05&|-@2|>|3+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e| |t|h|r|e@1|<+0#0000e05&|-@3|>|*+0#0000000&|<+0#0000e05&
|
||||
|-@4|>|l+0#0000000&|i|n|e|<+0#0000e05&|-@1|>|t+0#0000000&|h|r|e@1| @14
|
||||
@17|1|,|3|-|8|5| @6|A|l@1|
|
11
src/testdir/dumps/Test_prop_above_tablen_2.dump
Normal file
11
src/testdir/dumps/Test_prop_above_tablen_2.dump
Normal file
@ -0,0 +1,11 @@
|
||||
| +0&#ffffff0@15|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@9
|
||||
@16|a+0#4040ff13&|b|o|v|e| |2| +0#0000000&@9
|
||||
|<+0#0000e05&|-@5|>|<|-@5|>>o+0#0000000&|n|e| @13
|
||||
@8|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@17
|
||||
|<+0#0000e05&|-@5|>|t+0#0000000&|w|o| @21
|
||||
@8|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@17
|
||||
@3|<+0#0000e05&|-@2|>|3+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e| |t|h|r|e@1|<+0#0000e05&|-@3|>|*+0#0000000&
|
||||
|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e|<+0#0000e05&|-@1|>|t+0#0000000&|h|r|e@1| @12
|
||||
@3|<+0#0000e05&|-@2|>|3+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e| |t|h|r|e@1|<+0#0000e05&|-@3|>|*+0#0000000&
|
||||
|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e|<+0#0000e05&|-@1|>|t+0#0000000&|h|r|e@1| @12
|
||||
@17|1|,|3|-|8|3| @5|A|l@1|
|
11
src/testdir/dumps/Test_prop_above_tablen_3.dump
Normal file
11
src/testdir/dumps/Test_prop_above_tablen_3.dump
Normal file
@ -0,0 +1,11 @@
|
||||
| +0&#ffffff0@15|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@8
|
||||
@16|a+0#4040ff13&|b|o|v|e| |2| +0#0000000&@8
|
||||
|<+0#0000e05&|-@5|>|<|-@5|>>o+0#0000000&|n|e| @12
|
||||
@8|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@16
|
||||
|<+0#0000e05&|-@5|>|t+0#0000000&|w|o| @20
|
||||
@8|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@16
|
||||
@3|<+0#0000e05&|-@2|>|3+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e| |t|h|r|e@1|<+0#0000e05&|-@3|>
|
||||
|*+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e|<+0#0000e05&|-@1|>|t+0#0000000&|h|r|e@1| @10
|
||||
@3|<+0#0000e05&|-@2|>|3+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e| |t|h|r|e@1|<+0#0000e05&|-@3|>
|
||||
|*+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e|<+0#0000e05&|-@1|>|t+0#0000000&|h|r|e@1| @10
|
||||
@16|1|,|3|-|8|1| @5|A|l@1|
|
11
src/testdir/dumps/Test_prop_above_tablen_4.dump
Normal file
11
src/testdir/dumps/Test_prop_above_tablen_4.dump
Normal file
@ -0,0 +1,11 @@
|
||||
| +0&#ffffff0@15|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@7
|
||||
@16|a+0#4040ff13&|b|o|v|e| |2| +0#0000000&@7
|
||||
|<+0#0000e05&|-@5|>|<|-@5|>>o+0#0000000&|n|e| @11
|
||||
@8|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@15
|
||||
|<+0#0000e05&|-@5|>|t+0#0000000&|w|o| @19
|
||||
@8|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@15
|
||||
@3|<+0#0000e05&|-@2|>|3+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e| |t|h|r|e@1|<+0#0000e05&|-@3
|
||||
|>|*+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e|<+0#0000e05&|-@1|>|t+0#0000000&|h|r|e@1| @8
|
||||
@3|<+0#0000e05&|-@2|>|3+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e| |t|h|r|e@1|<+0#0000e05&|-@3
|
||||
|>|*+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e|<+0#0000e05&|-@1|>|t+0#0000000&|h|r|e@1| @8
|
||||
@16|1|,|3|-|7|9| @4|A|l@1|
|
11
src/testdir/dumps/Test_prop_above_tablen_5.dump
Normal file
11
src/testdir/dumps/Test_prop_above_tablen_5.dump
Normal file
@ -0,0 +1,11 @@
|
||||
| +0&#ffffff0@15|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@6
|
||||
@16|a+0#4040ff13&|b|o|v|e| |2| +0#0000000&@6
|
||||
|<+0#0000e05&|-@5|>|<|-@5|>>o+0#0000000&|n|e| @10
|
||||
@8|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@14
|
||||
|<+0#0000e05&|-@5|>|t+0#0000000&|w|o| @18
|
||||
@8|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@14
|
||||
@3|<+0#0000e05&|-@2|>|3+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e| |t|h|r|e@1|<+0#0000e05&|-@2
|
||||
@1|>|*+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e|<+0#0000e05&|-@1|>|t+0#0000000&|h|r|e@1| @6
|
||||
@3|<+0#0000e05&|-@2|>|3+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e| |t|h|r|e@1|<+0#0000e05&|-@2
|
||||
@1|>|*+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e|<+0#0000e05&|-@1|>|t+0#0000000&|h|r|e@1| @6
|
||||
@15|1|,|3|-|7@1| @4|A|l@1|
|
11
src/testdir/dumps/Test_prop_above_tablen_6.dump
Normal file
11
src/testdir/dumps/Test_prop_above_tablen_6.dump
Normal file
@ -0,0 +1,11 @@
|
||||
| +0&#ffffff0@15|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@5
|
||||
@16|a+0#4040ff13&|b|o|v|e| |2| +0#0000000&@5
|
||||
|<+0#0000e05&|-@5|>|<|-@5|>>o+0#0000000&|n|e| @9
|
||||
@8|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@13
|
||||
|<+0#0000e05&|-@5|>|t+0#0000000&|w|o| @17
|
||||
@8|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@13
|
||||
@3|<+0#0000e05&|-@2|>|3+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e| |t|h|r|e@1|<+0#0000e05&|-@1
|
||||
@2|>|*+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e|<+0#0000e05&|-@1|>|t+0#0000000&|h|r|e@1| @4
|
||||
@3|<+0#0000e05&|-@2|>|3+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e| |t|h|r|e@1|<+0#0000e05&|-@1
|
||||
@2|>|*+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e|<+0#0000e05&|-@1|>|t+0#0000000&|h|r|e@1| @4
|
||||
@15|1|,|3|-|7|5| @3|A|l@1|
|
11
src/testdir/dumps/Test_prop_above_tablen_7.dump
Normal file
11
src/testdir/dumps/Test_prop_above_tablen_7.dump
Normal file
@ -0,0 +1,11 @@
|
||||
| +0&#ffffff0@15|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@4
|
||||
@16|a+0#4040ff13&|b|o|v|e| |2| +0#0000000&@4
|
||||
|<+0#0000e05&|-@5|>|<|-@5|>>o+0#0000000&|n|e| @8
|
||||
@8|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@12
|
||||
|<+0#0000e05&|-@5|>|t+0#0000000&|w|o| @16
|
||||
@8|a+0#4040ff13&|b|o|v|e| |1| +0#0000000&@12
|
||||
@3|<+0#0000e05&|-@2|>|3+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e| |t|h|r|e@1|<+0#0000e05&|-
|
||||
@3|>|*+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e|<+0#0000e05&|-@1|>|t+0#0000000&|h|r|e@1| @2
|
||||
@3|<+0#0000e05&|-@2|>|3+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e| |t|h|r|e@1|<+0#0000e05&|-
|
||||
@3|>|*+0#0000000&|<+0#0000e05&|-@4|>|l+0#0000000&|i|n|e|<+0#0000e05&|-@1|>|t+0#0000000&|h|r|e@1| @2
|
||||
@14|1|,|3|-|7|3| @3|A|l@1|
|
@ -3732,6 +3732,38 @@ func Test_prop_above_with_indent()
|
||||
call prop_type_delete('indented')
|
||||
endfunc
|
||||
|
||||
func Test_prop_above_tablen()
|
||||
CheckRunVimInTerminal
|
||||
|
||||
let lines =<< trim END
|
||||
vim9script
|
||||
[
|
||||
"\t\tone",
|
||||
"\ttwo",
|
||||
" \t3\tline three\t*\tline\tthree",
|
||||
" \t3\tline three\t*\tline\tthree",
|
||||
]->setline(1)
|
||||
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, })
|
||||
prop_add(3, 0, { text: 'above 1', type: 'above', text_align: 'above', text_padding_left: 8, })
|
||||
set list listchars=tab:<->
|
||||
END
|
||||
call writefile(lines, 'XscriptPropAboveTab', 'D')
|
||||
let buf = RunVimInTerminal('-S XscriptPropAboveTab', #{cols: 34, rows: 11})
|
||||
call term_sendkeys(buf, "w")
|
||||
call VerifyScreenDump(buf, 'Test_prop_above_tablen_1', {})
|
||||
|
||||
"TODO: also test for cursor position
|
||||
for width in range(33, 28, -1)
|
||||
call term_sendkeys(buf, ":set columns="..width.."\<CR>")
|
||||
call VerifyScreenDump(buf, 'Test_prop_above_tablen_'..(35-width), {})
|
||||
endfor
|
||||
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
func Test_prop_above_with_number()
|
||||
CheckScreendump
|
||||
CheckRunVimInTerminal
|
||||
|
Loading…
x
Reference in New Issue
Block a user