patch 9.2.0094: popup: concealed text causes incorrect truncation
Commit:
https://github.com/vim/vim/commit/2c1f4dcbcc0b1d8350b372c46281c90a571cdffb
Author: Yasuhiro Matsumoto <
matt...@gmail.com>
Date: Mon Mar 2 19:45:11 2026 +0000
patch 9.2.0094: popup: concealed text causes incorrect truncation
Problem: In popup windows, concealed characters and tab expansion
may cause wrong truncation for fixed width windows.
Solution: Do not adjust the screen column and bogus column counters
for popup windows when handling concealed text or extra
padding characters (Yasuhiro Matsumoto).
closes: #19121
Signed-off-by: Yasuhiro Matsumoto <
matt...@gmail.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/src/drawline.c b/src/drawline.c
index 4597d8d3c..8880cb9a8 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -4182,20 +4182,34 @@ win_line(
// trailing junk to be written out of the screen line
// we are building, 'boguscols' keeps track of the number
// of bad columns we have advanced.
+ //
+ // For popup windows with fixed width, don't advance col
+ // to allow full text to be displayed.
+# ifdef FEAT_PROP_POPUP
+ int adjust_col = !WIN_IS_POPUP(wp);
+# else
+ int adjust_col = TRUE;
+# endif
if (wlv.n_extra > 0)
{
wlv.vcol += wlv.n_extra;
# ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
{
- wlv.col -= wlv.n_extra;
- wlv.boguscols -= wlv.n_extra;
+ if (adjust_col)
+ {
+ wlv.col -= wlv.n_extra;
+ wlv.boguscols -= wlv.n_extra;
+ }
}
else
# endif
{
- wlv.col += wlv.n_extra;
- wlv.boguscols += wlv.n_extra;
+ if (adjust_col)
+ {
+ wlv.col += wlv.n_extra;
+ wlv.boguscols += wlv.n_extra;
+ }
}
wlv.n_extra = 0;
n_attr = 0;
@@ -4207,28 +4221,40 @@ win_line(
# ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
{
- --wlv.boguscols;
- --wlv.col;
+ if (adjust_col)
+ {
+ --wlv.boguscols;
+ --wlv.col;
+ }
}
else
# endif
{
- ++wlv.boguscols;
- ++wlv.col;
+ if (adjust_col)
+ {
+ ++wlv.boguscols;
+ ++wlv.col;
+ }
}
}
# ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
{
- --wlv.boguscols;
- --wlv.col;
+ if (adjust_col)
+ {
+ --wlv.boguscols;
+ --wlv.col;
+ }
}
else
# endif
{
- ++wlv.boguscols;
- ++wlv.col;
+ if (adjust_col)
+ {
+ ++wlv.boguscols;
+ ++wlv.col;
+ }
}
}
else
diff --git a/src/testdir/dumps/Test_popupwin_conceal_01.dump b/src/testdir/dumps/Test_popupwin_conceal_01.dump
new file mode 100644
index 000000000..a5e92fa2f
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_conceal_01.dump
@@ -0,0 +1,10 @@
+>1+0&#ffffff0| @73
+|2| @73
+|3| @7|╔+0#0000001#ffd7ff255|═@39|╗| +0#0000000#ffffff0@23
+|4| @7|║+0#0000001#ffd7ff255|H|e|r|e| |i|s| |a| @1|w|o|r|d| |t|h|a|t| |w|i|l@1| |b|e| |h|i|d@1|e|n|.| @3|║| +0#0000000#ffffff0@23
+|5| @7|║+0#0000001#ffd7ff255| +0#4040ff13&@39|║+0#0000001&| +0#0000000#ffffff0@23
+|6| @7|╚+0#0000001#ffd7ff255|═@39|╝| +0#0000000#ffffff0@23
+|7| @73
+|8| @73
+|9| @73
+@57|1|,|1| @10|T|o|p|
diff --git a/src/testdir/dumps/Test_popupwin_conceal_02.dump b/src/testdir/dumps/Test_popupwin_conceal_02.dump
new file mode 100644
index 000000000..dfa240966
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_conceal_02.dump
@@ -0,0 +1,10 @@
+>1+0&#ffffff0| @73
+|2| @73
+|3| @7|╔+0#0000001#ffd7ff255|═@39|╗| +0#0000000#ffffff0@23
+|4| @7|║+0#0000001#ffd7ff255|H|e|r|e| |i|s| |a| @1|w|o|r|d| |t|h|a|t| |w|i|l@1| |b|e| |h|i|d@1|e|n|.| |A|n|d|║| +0#0000000#ffffff0@23
+|5| @7|║+0#0000001#ffd7ff255| |m|o|r|e| |t|e|x|t| |h|e|r|e|.| @23|║| +0#0000000#ffffff0@23
+|6| @7|╚+0#0000001#ffd7ff255|═@39|╝| +0#0000000#ffffff0@23
+|7| @73
+|8| @73
+|9| @73
+@57|1|,|1| @10|T|o|p|
diff --git a/src/testdir/dumps/Test_popupwin_conceal_03.dump b/src/testdir/dumps/Test_popupwin_conceal_03.dump
new file mode 100644
index 000000000..d2e1b2f36
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_conceal_03.dump
@@ -0,0 +1,10 @@
+>1+0&#ffffff0| @73
+|2| @73
+|3| @7|╔+0#0000001#ffd7ff255|═@39|╗| +0#0000000#ffffff0@23
+|4| @7|║+0#0000001#ffd7ff255|H|e|r|e|>+0#0000e05&|-@2|i+0#0000001&|s|>+0#0000e05&|-@4|a+0#0000001&| @1|w|o|r|d|>+0#0000e05&|-@7|w+0#0000001&|i|t|h|>+0#0000e05&|-@2|║+0#0000001&| +0#0000000#ffffff0@23
+|5| @7|║+0#0000001#ffd7ff255|t|a|b|s|.| @34|║| +0#0000000#ffffff0@23
+|6| @7|╚+0#0000001#ffd7ff255|═@39|╝| +0#0000000#ffffff0@23
+|7| @73
+|8| @73
+|9| @73
+@57|1|,|1| @10|T|o|p|
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 5f87f34e1..a2626a637 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -4899,4 +4899,54 @@ func Test_popup_opacity_wide_char_overlap()
call StopVimInTerminal(buf)
endfunc
+func Test_popup_conceal_wrap()
+ CheckFeature conceal
+ CheckScreendump
+
+ " Test that concealed text in popup windows doesn't cause truncation
+ let lines =<< trim END
+ call setline(1, range(1, 20))
+
+ " Create popup with concealed text
+ let text = "Here is a SECRET word that will be hidden."
+ let winid = popup_create([text], #{
+ \ line: 3,
+ \ col: 10,
+ \ minwidth: 40,
+ \ maxwidth: 40,
+ \ border: [],
+ \ wrap: 1,
+ \ })
+
+ " Set up conceal
+ call win_execute(winid, 'setlocal conceallevel=2')
+ call win_execute(winid, 'setlocal concealcursor=nvic')
+ call win_execute(winid, 'syntax match HiddenSecret /SECRET/ conceal containedin=ALL')
+ END
+ call writefile(lines, 'XtestPopupConceal', 'D')
+ let buf = RunVimInTerminal('-S XtestPopupConceal', #{rows: 10})
+ call VerifyScreenDump(buf, 'Test_popupwin_conceal_01', {})
+
+ " Test with longer text that wraps
+ call term_sendkeys(buf, ":call popup_close(winid)\<CR>")
+ call term_sendkeys(buf, ":let text2 = 'Here is a SECRET word that will be hidden. And more text here.'\<CR>")
+ call term_sendkeys(buf, ":let winid2 = popup_create([text2], #{line: 3, col: 10, minwidth: 40, maxwidth: 40, border: [], wrap: 1})\<CR>")
+ call term_sendkeys(buf, ":call win_execute(winid2, 'setlocal conceallevel=2')\<CR>")
+ call term_sendkeys(buf, ":call win_execute(winid2, 'setlocal concealcursor=nvic')\<CR>")
+ call term_sendkeys(buf, ":call win_execute(winid2, 'syntax match HiddenSecret /SECRET/ conceal containedin=ALL')\<CR>")
+ call VerifyScreenDump(buf, 'Test_popupwin_conceal_02', {})
+
+ " Test with TAB characters (uses n_extra)
+ call term_sendkeys(buf, ":call popup_close(winid2)\<CR>")
+ call term_sendkeys(buf, ":let text3 = \"Here\tis\ta SECRET word\twith\ttabs.\"\<CR>")
+ call term_sendkeys(buf, ":let winid3 = popup_create([text3], #{line: 3, col: 10, minwidth: 40, maxwidth: 40, border: [], wrap: 1})\<CR>")
+ call term_sendkeys(buf, ":call win_execute(winid3, 'setlocal conceallevel=2')\<CR>")
+ call term_sendkeys(buf, ":call win_execute(winid3, 'setlocal concealcursor=nvic')\<CR>")
+ call term_sendkeys(buf, ":call win_execute(winid3, 'setlocal list listchars=tab:>-')\<CR>")
+ call term_sendkeys(buf, ":call win_execute(winid3, 'syntax match HiddenSecret /SECRET/ conceal containedin=ALL')\<CR>")
+ call VerifyScreenDump(buf, 'Test_popupwin_conceal_03', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2
diff --git a/src/version.c b/src/version.c
index 40ab10bfe..46dcdaf5b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 94,
/**/
93,
/**/