Patch 9.0.0725
Problem: Virtual text "after" wraps to next line even when 'wrap' is off
and 'list' is set.
Solution: Do not use the minimum width when 'wrap' is off. (issue #11336)
Files: src/drawline.c, src/testdir/test_textprop.vim,
src/testdir/dumps/Test_text_after_nowrap_5.dump
*** ../vim-9.0.0724/src/drawline.c 2022-10-11 16:47:02.038010027 +0100
--- src/drawline.c 2022-10-11 20:57:32.878924131 +0100
***************
*** 583,590 ****
int strsize = 0;
int n_used;
! // if the remaining size is to small wrap anyway and use the next line
! if (space < PROP_TEXT_MIN_CELLS)
space += wp->w_width;
if (flags & (TP_FLAG_ALIGN_BELOW | TP_FLAG_ALIGN_ABOVE))
space -= padding;
--- 583,591 ----
int strsize = 0;
int n_used;
! // if the remaining size is to small and 'wrap' is set we wrap anyway and
! // use the next line
! if (space < PROP_TEXT_MIN_CELLS && wp->w_p_wrap)
space += wp->w_width;
if (flags & (TP_FLAG_ALIGN_BELOW | TP_FLAG_ALIGN_ABOVE))
space -= padding;
***************
*** 658,664 ****
? (col_with_padding <= col_off || !wp->w_p_wrap)
: (n_used < *n_extra)))
{
! if (right && (wrap || room < PROP_TEXT_MIN_CELLS))
{
// right-align on next line instead of wrapping if possible
before = wp->w_width - col_off - strsize + room;
--- 659,666 ----
? (col_with_padding <= col_off || !wp->w_p_wrap)
: (n_used < *n_extra)))
{
! if (right && (wrap
! || (room < PROP_TEXT_MIN_CELLS && wp->w_p_wrap)))
{
// right-align on next line instead of wrapping if possible
before = wp->w_width - col_off - strsize + room;
*** ../vim-9.0.0724/src/testdir/test_textprop.vim 2022-10-11
16:47:02.038010027 +0100
--- src/testdir/test_textprop.vim 2022-10-11 20:56:59.782940591 +0100
***************
*** 3289,3294 ****
--- 3289,3310 ----
text_padding_left: 1,
})
normal 2Gw
+ def g:ChangeText()
+ prop_clear(1)
+ set list
+ prop_add(1, 0, {
+ type: 'theprop',
+ text: 'just after txt '->repeat(3),
+ text_align: 'after',
+ text_padding_left: 2,
+ })
+ prop_add(1, 0, {
+ type: 'theprop',
+ text: 'in the middle '->repeat(4),
+ text_align: 'after',
+ text_padding_left: 1,
+ })
+ enddef
END
call writefile(lines, 'XTextAfterNowrap', 'D')
let buf = RunVimInTerminal('-S XTextAfterNowrap', #{rows: 8, cols: 60})
***************
*** 3303,3308 ****
--- 3319,3328 ----
call term_sendkeys(buf, "$")
call VerifyScreenDump(buf, 'Test_text_after_nowrap_4', {})
+ call term_sendkeys(buf, "0")
+ call term_sendkeys(buf, ":call ChangeText()\<CR>")
+ call VerifyScreenDump(buf, 'Test_text_after_nowrap_5', {})
+
call StopVimInTerminal(buf)
endfunc
*** ../vim-9.0.0724/src/testdir/dumps/Test_text_after_nowrap_5.dump
2022-10-11 20:59:24.086872779 +0100
--- src/testdir/dumps/Test_text_after_nowrap_5.dump 2022-10-11
20:57:52.238914761 +0100
***************
*** 0 ****
--- 1,8 ----
+ |f+0&#ffffff0|i|r|s|t| |l|i|n|e|$+0#4040ff13&|
+0#0000000&@1|j+0&#ffd7ff255|u|s|t| |a|f|t|e|r| |t|x|t| |j|u|s|t| |a|f|t|e|r|
|t|x|t| |j|u|s|t| |a|f|t|e|r| |t|x|t| | +0&#ffffff0|i+0&#ffd7ff255
+ >0+0&#ffffff0| |1| |2| |3| |4| |5| |6| |7| |8| |9| |1|0| |1@1| |1|2| |1|3|
|1|4| |1|5| |1|6| |1|7| |1|8| |1|9| |2|0| |2|1| |2@1| |2
+ |t|h|i|r|d|$+0#4040ff13&| +0#0000000&@53
+ |f|o|u|r|t|h|$+0#4040ff13&| +0#0000000&@52
+ |~+0#4040ff13&| @58
+ |~| @58
+ |~| @58
+ |:+0#0000000&|c|a|l@1| |C|h|a|n|g|e|T|e|x|t|(|)| @23|2|,|1| @10|A|l@1|
*** ../vim-9.0.0724/src/version.c 2022-10-11 20:04:05.880795466 +0100
--- src/version.c 2022-10-11 20:38:46.812263440 +0100
***************
*** 701,702 ****
--- 701,704 ----
{ /* Add new patch number below this line */
+ /**/
+ 725,
/**/
--
Q: How many hardware engineers does it take to change a lightbulb?
A: None. We'll fix it in software.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20221011200252.1C96E1C5296%40moolenaar.net.