diff options
-rw-r--r-- | src/drawline.c | 14 | ||||
-rw-r--r-- | src/testdir/dumps/Test_prop_above_number_1.dump | 8 | ||||
-rw-r--r-- | src/testdir/dumps/Test_prop_above_number_2.dump | 8 | ||||
-rw-r--r-- | src/testdir/test_textprop.vim | 31 | ||||
-rw-r--r-- | src/version.c | 2 |
5 files changed, 58 insertions, 5 deletions
diff --git a/src/drawline.c b/src/drawline.c index 8824a01212..e849f9d782 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -343,9 +343,14 @@ handle_lnum_col( int num_attr UNUSED) { int has_cpo_n = vim_strchr(p_cpo, CPO_NUMCOL) != NULL; + int lnum_row = wlv->startrow + wlv->filler_lines +#ifdef FEAT_PROP_POPUP + + wlv->text_prop_above_count +#endif + ; if ((wp->w_p_nu || wp->w_p_rnu) - && (wlv->row == wlv->startrow + wlv->filler_lines || !has_cpo_n) + && (wlv->row <= lnum_row || !has_cpo_n) // there is no line number in a wrapped line when "n" is in // 'cpoptions', but 'breakindent' assumes it anyway. && !((has_cpo_n @@ -366,10 +371,7 @@ handle_lnum_col( // Draw the line number (empty space after wrapping). // When there are text properties above the line put the line number // below them. - if (wlv->row == wlv->startrow + wlv->filler_lines -#ifdef FEAT_PROP_POPUP - + wlv->text_prop_above_count -#endif + if (wlv->row == lnum_row && (wp->w_skipcol == 0 || wlv->row > wp->w_winrow || (wp->w_p_nu && wp->w_p_rnu))) { @@ -1695,6 +1697,8 @@ win_line( { area_highlighting = TRUE; extra_check = TRUE; + // text props "above" move the line number down to where the + // text is. for (int i = 0; i < text_prop_count; ++i) if (text_props[i].tp_flags & TP_FLAG_ALIGN_ABOVE) ++wlv.text_prop_above_count; diff --git a/src/testdir/dumps/Test_prop_above_number_1.dump b/src/testdir/dumps/Test_prop_above_number_1.dump new file mode 100644 index 0000000000..d986a46209 --- /dev/null +++ b/src/testdir/dumps/Test_prop_above_number_1.dump @@ -0,0 +1,8 @@ +| +0#af5f00255#ffffff0@1|1| >o+0#0000000&|n|e| |o|n|e| |o|n|e| @59 +| +0#af5f00255&@3|a+0#0000000#ffd7ff255|b|o|v|e| |t|h|e| |t|e|x|t| +0&#ffffff0@56 +| +0#af5f00255&@1|2| |t+0#0000000&|w|o| |t|w|o| |t|w|o| @59 +| +0#af5f00255&@1|3| |t+0#0000000&|h|r|e@1| |t|h|r|e@1| |t|h|r|e@1| @53 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +| +0#0000000&@56|1|,|1| @10|A|l@1| diff --git a/src/testdir/dumps/Test_prop_above_number_2.dump b/src/testdir/dumps/Test_prop_above_number_2.dump new file mode 100644 index 0000000000..e1e5ba59e4 --- /dev/null +++ b/src/testdir/dumps/Test_prop_above_number_2.dump @@ -0,0 +1,8 @@ +| +0#af5f00255#ffffff0@1|1| >o+0#0000000&|n|e| |o|n|e| |o|n|e| @59 +| +0#af5f00255&@3|a+0#0000000#ffd7ff255|b|o|v|e| |t|h|e| |t|e|x|t| +0&#ffffff0@56 +| +0#af5f00255&@3|a+0#0000000#ffd7ff255|l|s|o| |a|b|o|v|e| |t|h|e| |t|e|x|t| +0&#ffffff0@51 +| +0#af5f00255&@1|2| |t+0#0000000&|w|o| |t|w|o| |t|w|o| @59 +| +0#af5f00255&@1|3| |t+0#0000000&|h|r|e@1| |t|h|r|e@1| |t|h|r|e@1| @53 +|~+0#4040ff13&| @73 +|~| @73 +| +0#0000000&@56|1|,|1| @10|A|l@1| diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index 39898eb4a7..80ad88c6d4 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -2964,6 +2964,37 @@ func Test_prop_above_with_indent() call prop_type_delete('indented') endfunc +func Test_prop_above_with_number() + CheckRunVimInTerminal + + let lines =<< trim END + vim9script + setline(1, ['one one one', 'two two two', 'three three three']) + set number cpo+=n + prop_type_add('test', {highlight: 'DiffChange'}) + prop_add(2, 0, { + text: 'above the text', + type: 'test', + text_align: 'above', + }) + def g:OneMore() + prop_add(2, 0, { + text: 'also above the text', + type: 'test', + text_align: 'above', + }) + enddef + END + call writefile(lines, 'XscriptPropAboveNr', 'D') + let buf = RunVimInTerminal('-S XscriptPropAboveNr', #{rows: 8}) + call VerifyScreenDump(buf, 'Test_prop_above_number_1', {}) + + call term_sendkeys(buf, ":call OneMore()\<CR>") + call VerifyScreenDump(buf, 'Test_prop_above_number_2', {}) + + call StopVimInTerminal(buf) +endfunc + func Test_prop_below_split_line() CheckRunVimInTerminal diff --git a/src/version.c b/src/version.c index 0f6b59aa86..b912819a8c 100644 --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 784, +/**/ 783, /**/ 782, |