Commit: runtime(doc): Update popup width rule

Christian Brabandt <[email protected]> Wed, 29 Jul 2026 20:45:07 +0200
Newsgroups gmane.editors.vim.devel
Message-ID <[email protected]>
runtime(doc): Update popup width rule

Commit: https://github.com/vim/vim/commit/3d863d6aa15f2305848f82b61b5876d48e811ec8
Author: Hirohito Higashi <[email protected]>
Date:   Tue Jul 28 20:50:27 2026 +0000

    runtime(doc): Update popup width rule
    
    Problem:  The documentation says the width of a popup window is equal to
              the longest visible line, while since 9.2.0419 it is the
              longest line in the buffer, also when that line is not
              displayed.
    Solution: Update the documentation and correct a comment that says
              otherwise.
    
    Reported: https://groups.google.com/g/vim_use/c/_rOLxGz5kNM
    
    related: #20042
    closes:  #20870
    
    Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/doc/popup.txt b/runtime/doc/popup.txt
index ef3310638..d002df11d 100644
--- a/runtime/doc/popup.txt
+++ b/runtime/doc/popup.txt
@@ -1,4 +1,4 @@
-*popup.txt*	For Vim version 9.2.  Last change: 2026 Jun 17
+*popup.txt*	For Vim version 9.2.  Last change: 2026 Jul 29
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -79,9 +79,11 @@ wrapping, lines in the buffer.  It can be limited with the "maxheight"
 property.  You can use empty lines to increase the height or the "minheight"
 property.
 
-The width of the window is normally equal to the longest visible line in the
-buffer.  It can be limited with the "maxwidth" property.  You can use spaces
-to increase the width or use the "minwidth" property.
+The width of the window is normally equal to the longest line in the buffer,
+also when that line is not displayed.  This keeps the width the same while
+scrolling through the popup.  It can be limited with the "maxwidth" property,
+which is a good idea when the buffer may contain long lines.  You can use
+spaces to increase the width or use the "minwidth" property.
 
 By default the 'wrap' option is set, so that no text disappears.  Otherwise,
 if there is not enough space then the window is shifted left in order to
diff --git a/src/popupwin.c b/src/popupwin.c
index 7ef2d766a..2149ee099 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -2700,7 +2700,8 @@ popup_adjust_position(win_T *wp)
 	else
 	    ++lnum;
 
-	// do not use the width of lines we're not going to show
+	// stop at the last line that is going to be shown; the width was
+	// already computed above from every buffer line
 	if (maxheight > 0
 		   && (wp->w_firstline >= 0
 			       ? lnum - wp->w_topline

-- 
-- 
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 visit https://groups.google.com/d/msgid/vim_dev/E1wp9H9-002sX6-Aw%40256bit.org.