// 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;
# 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
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