[vim/vim] fix text truncation on conceal text in popup windows (PR #19121)

6 views
Skip to first unread message

mattn

unread,
Jan 7, 2026, 12:40:59 AMJan 7
to vim/vim, Subscribed

Problem

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.

Reproduction

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

Current (Incorrect) Output

+ 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."

Expected Output

+ 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.

Root Cause

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:

  1. wlv.col is incremented for each concealed character (to maintain cursor position)
  2. When wlv.col >= wp->w_width, the line is considered full and wraps
  3. But in popup windows, this prevents the actual visible text from using the full width

Solution

For 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).


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/19121

Commit Summary

  • b4923a1 Conceal feature in popup windows with fixed width causes text to be

File Changes

(4 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19121@github.com>

mattn

unread,
Jan 7, 2026, 12:42:40 AMJan 7
to vim/vim, Subscribed
mattn left a comment (vim/vim#19121)

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.Message ID: <vim/vim/pull/19121/c3717401581@github.com>

mattn

unread,
Jan 7, 2026, 12:46:35 AMJan 7
to vim/vim, Push

@mattn pushed 1 commit.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19121/before/b4923a10290f20daf3efa6375b1331738ea58f4f/after/1cc8813e19795899f6186cfa078d0077bdcfdaa4@github.com>

mattn

unread,
Jan 7, 2026, 1:49:54 AMJan 7
to vim/vim, Push

@mattn pushed 1 commit.

  • 5d07148 add n_extra test case for conceal in popup

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19121/before/1cc8813e19795899f6186cfa078d0077bdcfdaa4/after/5d07148674081b590a95fefc3289c8e3d21c4259@github.com>

h_east

unread,
Jan 7, 2026, 6:45:30 AMJan 7
to vim/vim, Subscribed

@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.Message ID: <vim/vim/pull/19121/review/3634496175@github.com>

mattn

unread,
Jan 7, 2026, 7:25:46 AMJan 7
to vim/vim, Push

@mattn pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19121/before/5d07148674081b590a95fefc3289c8e3d21c4259/after/7201debb79eb50f734ea0974fd6f09f285ec26b8@github.com>

mattn

unread,
Jan 7, 2026, 7:27:35 AMJan 7
to vim/vim, Push

@mattn pushed 0 commits.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19121/before/7201debb79eb50f734ea0974fd6f09f285ec26b8/after/5d07148674081b590a95fefc3289c8e3d21c4259@github.com>

mattn

unread,
Jan 7, 2026, 7:29:38 AMJan 7
to vim/vim, Push

@mattn pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19121/before/5d07148674081b590a95fefc3289c8e3d21c4259/after/c3fa3baa542374a3bd1303194bed33ee85bdd70e@github.com>

Christian Brabandt

unread,
2:55 PM (6 hours ago) 2:55 PM
to vim/vim, Subscribed

Closed #19121 via 2c1f4dc.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19121/issue_event/23204136806@github.com>

Christian Brabandt

unread,
2:59 PM (6 hours ago) 2:59 PM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19121)

thanks


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19121/c3986596626@github.com>

Reply all
Reply to author
Forward
0 new messages