diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-09-11 13:31:01 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-09-11 13:31:01 +0100 |
commit | 79f8b8494cd4f738f25272ece94d8b524b99cb09 (patch) | |
tree | d154633dd6a83323406eb07f108729d555647683 | |
parent | c069edeab28bdd7289d7096cd92804cb54841557 (diff) |
patch 9.0.0442: virtual text "above" doesn't handel line numbersv9.0.0442
Problem: Virtual text "above" doesn't handel line numbers.
Solution: Take the left column offset into account. (issue #11084)
Also make padding work.
-rw-r--r-- | src/drawline.c | 8 | ||||
-rw-r--r-- | src/testdir/dumps/Test_prop_with_text_above_1.dump | 2 | ||||
-rw-r--r-- | src/testdir/dumps/Test_prop_with_text_above_2.dump | 2 | ||||
-rw-r--r-- | src/testdir/dumps/Test_prop_with_text_above_3.dump | 2 | ||||
-rw-r--r-- | src/testdir/dumps/Test_prop_with_text_above_4.dump | 9 | ||||
-rw-r--r-- | src/testdir/test_textprop.vim | 5 | ||||
-rw-r--r-- | src/version.c | 2 |
7 files changed, 23 insertions, 7 deletions
diff --git a/src/drawline.c b/src/drawline.c index 56d42e2a7f..7f9660349b 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -350,7 +350,7 @@ text_prop_position( if (above) { before = 0; - after = wp->w_width - cells; + after = wp->w_width - cells - win_col_off(wp) - padding; } else { @@ -436,6 +436,8 @@ text_prop_position( *p_extra = l; *n_extra = n_used + before + after + padding; *n_attr = mb_charlen(*p_extra); + if (above) + *n_attr -= padding; *n_attr_skip = before + padding + col_off; } } @@ -1858,8 +1860,8 @@ win_line( dont_use_showbreak = TRUE; } #endif - if ((right || above || below || !wrap || padding > 0) - && wp->w_width > 2) + if ((right || above || below || !wrap + || padding > 0) && wp->w_width > 2) { char_u *prev_p_extra = wlv.p_extra; int start_line; diff --git a/src/testdir/dumps/Test_prop_with_text_above_1.dump b/src/testdir/dumps/Test_prop_with_text_above_1.dump index cc68f5e50c..6f2b09d616 100644 --- a/src/testdir/dumps/Test_prop_with_text_above_1.dump +++ b/src/testdir/dumps/Test_prop_with_text_above_1.dump @@ -2,7 +2,7 @@ |s+0&#ffd7ff255|e|c|o|n|d| |t|h|i|n|g| |a|b|o|v|e| @41 |o+0&#ffffff0|n|e| |t|w|o| @52 |t|h|r>e@1| |f|o|u|r| @49 -|a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| @46 +@3|a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| @43 |f+0&#ffffff0|i|v|e| |s|i|x| @51 |~+0#4040ff13&| @58 |~| @58 diff --git a/src/testdir/dumps/Test_prop_with_text_above_2.dump b/src/testdir/dumps/Test_prop_with_text_above_2.dump index 7f45faf118..7c84c73c49 100644 --- a/src/testdir/dumps/Test_prop_with_text_above_2.dump +++ b/src/testdir/dumps/Test_prop_with_text_above_2.dump @@ -2,7 +2,7 @@ |s+0&#ffd7ff255|e|c|o|n|d| |t|h|i|n|g| |a|b|o|v|e| @41 >o+0&#ffffff0|n|e| |t|w|o| @52 |t|h|r|e@1| |f|o|u|r| @49 -|a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| @46 +@3|a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| @43 |f+0&#ffffff0|i|v|e| |s|i|x| @51 |~+0#4040ff13&| @58 |~| @58 diff --git a/src/testdir/dumps/Test_prop_with_text_above_3.dump b/src/testdir/dumps/Test_prop_with_text_above_3.dump index 8a4b1d4917..a7277c2e37 100644 --- a/src/testdir/dumps/Test_prop_with_text_above_3.dump +++ b/src/testdir/dumps/Test_prop_with_text_above_3.dump @@ -2,7 +2,7 @@ |s+0&#ffd7ff255|e|c|o|n|d| |t|h|i|n|g| |a|b|o|v|e| @41 |i+0&#ffffff0|n|s|e|r|t|e|d> |o|n|e| |t|w|o| @43 |t|h|r|e@1| |f|o|u|r| @49 -|a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| @46 +@3|a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| @43 |f+0&#ffffff0|i|v|e| |s|i|x| @51 |~+0#4040ff13&| @58 |~| @58 diff --git a/src/testdir/dumps/Test_prop_with_text_above_4.dump b/src/testdir/dumps/Test_prop_with_text_above_4.dump new file mode 100644 index 0000000000..1ab0b69fd6 --- /dev/null +++ b/src/testdir/dumps/Test_prop_with_text_above_4.dump @@ -0,0 +1,9 @@ +| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|1| |f+0#0000000#ffff4012|i|r|s|t| |t|h|i|n|g| |a|b|o|v|e| @36 +| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|s+0#0000000#ffd7ff255|e|c|o|n|d| |t|h|i|n|g| |a|b|o|v|e| @35 +| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|i+0#0000000&|n|s|e|r|t|e|d> |o|n|e| |t|w|o| @37 +| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|2| |t+0#0000000&|h|r|e@1| |f|o|u|r| @43 +| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@1|3| | +0#0000000&@2|a+0&#ffff4012|n|o|t|h|e|r| |t|h|i|n|g| @37 +| +0#0000e05#a8a8a8255@1| +0#af5f00255#ffffff0@3|f+0#0000000&|i|v|e| |s|i|x| @45 +|~+0#4040ff13&| @58 +|~| @58 +| +0#0000000&@41|1|,|9|-|1@1|7| @6|A|l@1| diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index f97772ce63..6e3ca3b1d1 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -2857,7 +2857,7 @@ func Test_props_with_text_above() call prop_type_add('above2', #{highlight: 'DiffChange'}) call prop_add(1, 0, #{type: 'above1', text: 'first thing above', text_align: 'above'}) call prop_add(1, 0, #{type: 'above2', text: 'second thing above', text_align: 'above'}) - call prop_add(3, 0, #{type: 'above1', text: 'another thing', text_align: 'above'}) + call prop_add(3, 0, #{type: 'above1', text: 'another thing', text_align: 'above', text_padding_left: 3}) normal gglllj END @@ -2870,6 +2870,9 @@ func Test_props_with_text_above() call term_sendkeys(buf, "inserted \<Esc>") call VerifyScreenDump(buf, 'Test_prop_with_text_above_3', {}) + call term_sendkeys(buf, ":set number signcolumn=yes\<CR>") + call VerifyScreenDump(buf, 'Test_prop_with_text_above_4', {}) + call StopVimInTerminal(buf) endfunc diff --git a/src/version.c b/src/version.c index b7bc80a1f2..9d4f39be90 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 442, +/**/ 441, /**/ 440, |