diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-08-10 13:12:03 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-08-10 13:12:03 +0100 |
commit | 52de3a8d3943520bbd4e5e40a4c43fcc7182dac0 (patch) | |
tree | f0a94f73e6b00c4806f3abb0db025003bbee4682 | |
parent | 3a9687fb2749cb3da6e3bbf60cb9eaa81f7889ae (diff) |
patch 9.0.0183: extra space after virtual text when 'linebreak' is setv9.0.0183
Problem: Extra space after virtual text when 'linebreak' is set.
Solution: Do not count virtual text when getting linebreak value.
(closes #10884)
-rw-r--r-- | src/drawline.c | 9 | ||||
-rw-r--r-- | src/testdir/dumps/Test_prop_with_linebreak_1.dump | 6 | ||||
-rw-r--r-- | src/testdir/dumps/Test_prop_with_linebreak_2.dump | 6 | ||||
-rw-r--r-- | src/testdir/test_textprop.vim | 20 | ||||
-rw-r--r-- | src/version.c | 2 |
5 files changed, 40 insertions, 3 deletions
diff --git a/src/drawline.c b/src/drawline.c index 3a9c7a3a48..0300f373a6 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -2370,7 +2370,12 @@ win_line( chartabsize_T cts; init_chartabsize_arg(&cts, wp, lnum, wlv.vcol, line, p); +# ifdef FEAT_PROP_POPUP + // do not want virtual text counted here + cts.cts_has_prop_with_text = FALSE; +# endif wlv.n_extra = win_lbr_chartabsize(&cts, NULL) - 1; + clear_chartabsize_arg(&cts); // We have just drawn the showbreak value, no need to add // space for it again. @@ -2398,7 +2403,7 @@ win_line( wlv.c_extra = mb_off > 0 ? MB_FILLER_CHAR : ' '; wlv.c_final = NUL; -# if defined(FEAT_PROP_POPUP) +# ifdef FEAT_PROP_POPUP if (wlv.n_extra > 0 && c != TAB) in_linebreak = TRUE; # endif @@ -2412,10 +2417,8 @@ win_line( if (!wp->w_p_list) c = ' '; } - clear_chartabsize_arg(&cts); } #endif - in_multispace = c == ' ' && ((ptr > line + 1 && ptr[-2] == ' ') || *ptr == ' '); if (!in_multispace) diff --git a/src/testdir/dumps/Test_prop_with_linebreak_1.dump b/src/testdir/dumps/Test_prop_with_linebreak_1.dump new file mode 100644 index 0000000000..9cae5d621b --- /dev/null +++ b/src/testdir/dumps/Test_prop_with_linebreak_1.dump @@ -0,0 +1,6 @@ +>o+0&#ffffff0|n|e|:+0#e000e06&| |v|i|r|t|u|a|l| |t|e|x|t| +0#0000000&|t|w|o|w|o|r|d| @24 +|~+0#4040ff13&| @48 +|~| @48 +|~| @48 +|~| @48 +| +0#0000000&@31|1|,|1| @10|A|l@1| diff --git a/src/testdir/dumps/Test_prop_with_linebreak_2.dump b/src/testdir/dumps/Test_prop_with_linebreak_2.dump new file mode 100644 index 0000000000..6614eb2b74 --- /dev/null +++ b/src/testdir/dumps/Test_prop_with_linebreak_2.dump @@ -0,0 +1,6 @@ +|a+0&#ffffff0|s|d|f| |a|s|d|f| |a|s|d|f| |a|s|d|f| |a|s|d|f| |a>s|o|n|e|:+0#e000e06&| |v|i|r|t|u|a|l| |t|e|x|t| +0#0000000&@5 +|t|w|o|w|o|r|d| @42 +|~+0#4040ff13&| @48 +|~| @48 +|~| @48 +| +0#0000000&@31|1|,|2|7| @9|A|l@1| diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index 17a2af5d6f..dd3f760aaa 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -1878,6 +1878,26 @@ func Test_prop_in_linebreak() call delete('XscriptPropLinebreak') endfunc +func Test_prop_with_linebreak() + CheckRunVimInTerminal + + let lines =<< trim END + vim9script + set linebreak + setline(1, 'one twoword') + prop_type_add('test', {highlight: 'Special'}) + prop_add(1, 4, {text: ': virtual text', type: 'test', text_wrap: 'wrap'}) + END + call writefile(lines, 'XscriptPropWithLinebreak') + let buf = RunVimInTerminal('-S XscriptPropWithLinebreak', #{rows: 6, cols: 50}) + call VerifyScreenDump(buf, 'Test_prop_with_linebreak_1', {}) + call term_sendkeys(buf, "iasdf asdf asdf asdf asdf as\<Esc>") + call VerifyScreenDump(buf, 'Test_prop_with_linebreak_2', {}) + + call StopVimInTerminal(buf) + call delete('XscriptPropWithLinebreak') +endfunc + func Test_prop_after_tab() CheckRunVimInTerminal diff --git a/src/version.c b/src/version.c index 5341870452..582cb3655a 100644 --- a/src/version.c +++ b/src/version.c @@ -736,6 +736,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 183, +/**/ 182, /**/ 181, |