When using conceal feature inside popup windows with fixed width, text is incorrectly truncated before reaching the popup's maxwidth. This happens because the conceal mechanism uses boguscols to track "phantom columns" for concealed characters, causing the rendering logic to think the line has reached the window width earlier than it actually has.
Run the following script:
set nocp let lines = [ \ "Here is a SECRET word that will be hidden."] let s:win = popup_create(lines, { \ 'line': 1, \ 'col': 1, \ 'minwidth': 40, \ 'maxwidth': 40, \ 'maxheight': 10, \ 'border': [1,1,1,1], \ 'borderchars': ['-', '|', '-', '|', '+', '+', '+', '+'], \ 'wrap': 1, \ 'title': ' Conceal Popup Example ', \ }) call win_execute(s:win, join([ \ 'setlocal conceallevel=2', \ 'setlocal concealcursor=nvic', \ 'syntax match HiddenSecret /SECRET/ conceal containedin=ALL', \ ], " | ")) redraw
+ Conceal Popup Example -----------------+
|Here is a word that will be hidde |
|n. |
+----------------------------------------+
The text is truncated at "hidde" (40 characters including the concealed "SECRET" word's phantom space), cutting off "n." from "hidden."
+ Conceal Popup Example -----------------+
|Here is a word that will be hidden. |
| |
+----------------------------------------+
The full text should be displayed within the 40-character width, since "SECRET" (6 chars) is concealed to a single space, making the actual visible text 37 characters.
In drawline.c, the conceal handling for wrapped lines uses boguscols to track phantom columns. The logic advances both wlv.col and wlv.boguscols to maintain consistent cursor positioning in normal windows. However, for popup windows with fixed maxwidth, this causes premature line wrapping because:
wlv.col is incremented for each concealed character (to maintain cursor position)wlv.col >= wp->w_width, the line is considered full and wrapsFor popup windows with fixed width, skip the boguscols and col adjustments during conceal processing. This allows the actual visible content to determine when the line should wrap, rather than including phantom columns in the calculation.
The fix adds a check !WIN_IS_POPUP(wp) before adjusting wlv.col and wlv.boguscols in the conceal handling code, ensuring popup windows render concealed text correctly while maintaining the existing behavior for normal windows (where cursor position calculations depend on these adjustments).
https://github.com/vim/vim/pull/19121
(4 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
BTW, this changes works fine with multi-byte text.
+ Conceal Popup Example -----------------+
|Here is a word that will be hiddeあいう|
|えn. |
+----------------------------------------+
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@mattn pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@h-east commented on this pull request.
In src/drawline.c:
> +#ifdef FEAT_PROP_POPUP + int adjust_col = !WIN_IS_POPUP(wp); +#else + int adjust_col = TRUE; +#endif
Nested preprocessor directives should be indented with spaces according to the nesting level.
⬇️ Suggested change-#ifdef FEAT_PROP_POPUP - int adjust_col = !WIN_IS_POPUP(wp); -#else - int adjust_col = TRUE; -#endif +# ifdef FEAT_PROP_POPUP + int adjust_col = !WIN_IS_POPUP(wp); +# else + int adjust_col = TRUE; +# endif
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@mattn pushed 0 commits.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
thanks
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()