]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0710: popup window may hide part of Command line v9.1.0710
authorChristian Brabandt <cb@256bit.org>
Tue, 3 Sep 2024 16:20:13 +0000 (18:20 +0200)
committerChristian Brabandt <cb@256bit.org>
Tue, 3 Sep 2024 16:20:13 +0000 (18:20 +0200)
Problem:  when a popup window covers the command line,
          the command line is not completely cleared on popup_hide()
          (yu3s)
Solution: Check if the popup window covers the command line and if it
          does, set the clear_cmdline flag.

fixes: #15608
closes: #15610

Signed-off-by: Christian Brabandt <cb@256bit.org>
src/popupwin.c
src/testdir/dumps/Test_echowindow_9.dump
src/testdir/dumps/Test_popupwin_hide_clear_cmdline_01.dump [new file with mode: 0644]
src/testdir/test_popupwin.vim
src/version.c

index 0ff57fb4b131b8901ad8a53c089e1b6b5789b58a..8c567173f9e69cec58766833f727d8352b57da0c 100644 (file)
@@ -2758,6 +2758,8 @@ popup_hide(win_T *wp)
 
     wp->w_popup_flags |= POPF_HIDDEN;
     // Do not decrement b_nwindows, we still reference the buffer.
+    if (wp->w_winrow + popup_height(wp) >= cmdline_row)
+       clear_cmdline = TRUE;
     redraw_all_later(UPD_NOT_VALID);
     popup_mask_refresh = TRUE;
 }
index 2efdef062fc78686ee53a38c7a0de886aafdf5b4..8c48d62fd4d7abae7ab3e4ece7d03871ae87e2a5 100644 (file)
@@ -4,5 +4,5 @@
 |~| @73
 |~| @73
 |~| @73
-|:+0#0000000&|c|a|l@1| |H|i|d|e|W|i|n|(|)| @59
+| +0#0000000&@74
 @57|0|,|0|-|1| @8|A|l@1| 
diff --git a/src/testdir/dumps/Test_popupwin_hide_clear_cmdline_01.dump b/src/testdir/dumps/Test_popupwin_hide_clear_cmdline_01.dump
new file mode 100644 (file)
index 0000000..25a79ea
--- /dev/null
@@ -0,0 +1,10 @@
+>f+0&#ffffff0|o@1|b|a|r| |o|n|e| |t|w|o| |t|h|r|e@1| @54
+|f|o@1|b|a|r| |o|n|e| |t|w|o| |t|h|r|e@1| @54
+|f|o@1|b|a|r| |o|n|e| |t|w|o| |t|h|r|e@1| @54
+|f|o@1|b|a|r| |o|n|e| |t|w|o| |t|h|r|e@1| @54
+|f|o@1|b|a|r| |o|n|e| |t|w|o| |t|h|r|e@1| @54
+|f|o@1|b|a|r| |o|n|e| |t|w|o| |t|h|r|e@1| @54
+|f|o@1|b|a|r| |o|n|e| |t|w|o| |t|h|r|e@1| @54
+|f|o@1|b|a|r| |o|n|e| |t|w|o| |t|h|r|e@1| @54
+|f|o@1|b|a|r| |o|n|e| |t|w|o| |t|h|r|e@1| @54
+@57|1|,|1| @10|T|o|p| 
index 64aa654cf7c1183230af99c6a58c78a67b8db2be..23f318fd6ef660aebbc1a45d1ba9250792f4b90b 100644 (file)
@@ -4315,4 +4315,67 @@ func Test_popupwin_setbufvar_changing_window_view()
   bw!
 endfunc
 
+func Test_popupwin_clears_cmdline_on_hide()
+  " Test that the command line is properly cleared for overlong
+  " popup windows and using popup_hide()
+  CheckScreendump
+
+  let lines =<< trim END
+    vim9script
+    var id: number
+    def Filter(winid: number, key: string): bool
+      if key == 'q'
+        popup_hide(winid)
+      else
+        return false
+      endif
+      return true
+    enddef
+    setline(1, repeat(['foobar one two three'], &lines))
+    id = popup_create(1, {
+      col: 1,
+      minwidth: &columns,
+      maxwidth: &columns,
+      minheight: &lines,
+      maxheight: &lines,
+      filter: Filter,
+    })
+  END
+  call writefile(lines, 'XtestPopup_win', 'D')
+  let buf = RunVimInTerminal('-S XtestPopup_win', #{rows: 10})
+  call term_sendkeys(buf, "q")
+  call term_wait(buf)
+  call VerifyScreenDump(buf, 'Test_popupwin_hide_clear_cmdline_01', {})
+  call StopVimInTerminal(buf)
+  let lines =<< trim END
+    vim9script
+    var id: number
+    def Filter(winid: number, key: string): bool
+      if key == 'q'
+        popup_close(winid)
+      else
+        return false
+      endif
+      return true
+    enddef
+    setline(1, repeat(['foobar one two three'], &lines))
+    id = popup_create(1, {
+      col: 1,
+      minwidth: &columns,
+      maxwidth: &columns,
+      minheight: &lines,
+      maxheight: &lines,
+      filter: Filter,
+    })
+  END
+  call writefile(lines, 'XtestPopup_win2', 'D')
+  let buf = RunVimInTerminal('-S XtestPopup_win2', #{rows: 10})
+  call term_sendkeys(buf, "q")
+  call term_wait(buf)
+  call VerifyScreenDump(buf, 'Test_popupwin_hide_clear_cmdline_01', {})
+
+  " clean up
+  call StopVimInTerminal(buf)
+endfunc
+
 " vim: shiftwidth=2 sts=2
index 2c9ae2c1e706c317d4e99e11f505dde773feb378..affc9d74ef329116b9ca62da5e1edb856b911986 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    710,
 /**/
     709,
 /**/