Patch 9.0.0294
Problem: Crash when 'cmdheight' is 0 and popup_clear() used.
Solution: Reset "message_win" when the message popup is cleared. Close the
popup when 'cmdheight' is non-zero. Add a screendump test.
Files: src/popupwin.c, src/proto/popupwin.pro, src/window.c,
src/testdir/test_messages.vim,
src/testdir/dumps/Test_cmdheight_zero_1.dump,
src/testdir/dumps/Test_cmdheight_zero_2.dump,
src/testdir/dumps/Test_cmdheight_zero_3.dump
*** ../vim-9.0.0293/src/popupwin.c 2022-08-27 21:29:28.257402847 +0100
--- src/popupwin.c 2022-08-28 12:44:14.284013995 +0100
***************
*** 28,33 ****
--- 28,38 ----
{"center", POPPOS_CENTER}
};
+ #ifdef HAS_MESSAGE_WINDOW
+ // Window used for messages when 'winheight' is zero.
+ static win_T *message_win = NULL;
+ #endif
+
static void popup_adjust_position(win_T *wp);
/*
***************
*** 2770,2775 ****
--- 2775,2785 ----
clear_cmdline = TRUE;
win_free_popup(wp);
+ #ifdef HAS_MESSAGE_WINDOW
+ if (wp == message_win)
+ message_win = NULL;
+ #endif
+
redraw_all_later(UPD_NOT_VALID);
popup_mask_refresh = TRUE;
}
***************
*** 4440,4448 ****
#if defined(HAS_MESSAGE_WINDOW) || defined(PROTO)
- // Window used for messages when 'winheight' is zero.
- static win_T *message_win = NULL;
-
/*
* Get the message window.
* Returns NULL if something failed.
--- 4450,4455 ----
***************
*** 4516,4521 ****
--- 4523,4538 ----
popup_hide(message_win);
}
+ /*
+ * If the message window exists: close it.
+ */
+ void
+ popup_close_message_win(void)
+ {
+ if (message_win != NULL)
+ popup_close(message_win->w_id, TRUE);
+ }
+
#endif
/*
*** ../vim-9.0.0293/src/proto/popupwin.pro 2022-08-27 21:29:28.257402847
+0100
--- src/proto/popupwin.pro 2022-08-28 12:44:12.604013174 +0100
***************
*** 66,71 ****
--- 66,72 ----
void popup_show_message_win(void);
int popup_message_win_visible(void);
void popup_hide_message_win(void);
+ void popup_close_message_win(void);
int popup_win_closed(win_T *win);
void popup_set_title(win_T *wp);
void popup_update_preview_title(void);
*** ../vim-9.0.0293/src/window.c 2022-08-25 16:02:09.681816465 +0100
--- src/window.c 2022-08-28 12:44:03.928008838 +0100
***************
*** 6603,6608 ****
--- 6603,6613 ----
// Recompute window positions.
if (frp != lastwin->w_frame)
(void)win_comp_pos();
+
+ #ifdef HAS_MESSAGE_WINDOW
+ if (p_ch > 0)
+ popup_close_message_win();
+ #endif
}
/*
*** ../vim-9.0.0293/src/testdir/test_messages.vim 2022-08-28
12:06:17.816288642 +0100
--- src/testdir/test_messages.vim 2022-08-28 12:59:30.267879091 +0100
***************
*** 471,474 ****
--- 471,502 ----
redraw
endfunc
+ func Test_cmdheight_zero_dump()
+ CheckScreendump
+
+ let lines =<< trim END
+ set cmdheight=0
+ set showmode
+ call setline(1, 'some text')
+ END
+ call writefile(lines, 'XtestCmdheight')
+ let buf = RunVimInTerminal('-S XtestCmdheight', #{rows: 6})
+ " The "-- INSERT --" indicator should not be visible.
+ call term_sendkeys(buf, "i")
+ call VerifyScreenDump(buf, 'Test_cmdheight_zero_1', {})
+
+ " The "-- VISUAL --" indicator should not be visible.
+ call term_sendkeys(buf, "\<Esc>vw")
+ call VerifyScreenDump(buf, 'Test_cmdheight_zero_2', {})
+
+ " Echo'd text is in a popup window
+ call term_sendkeys(buf, "\<Esc>:echo 'message window'\<CR>")
+ call VerifyScreenDump(buf, 'Test_cmdheight_zero_3', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('XtestCmdheight')
+ endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.0293/src/testdir/dumps/Test_cmdheight_zero_1.dump
2022-08-28 13:01:32.383815277 +0100
--- src/testdir/dumps/Test_cmdheight_zero_1.dump 2022-08-28
12:54:52.492000137 +0100
***************
*** 0 ****
--- 1,6 ----
+ >s+0&#ffffff0|o|m|e| |t|e|x|t| @65
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
*** ../vim-9.0.0293/src/testdir/dumps/Test_cmdheight_zero_2.dump
2022-08-28 13:01:32.387815275 +0100
--- src/testdir/dumps/Test_cmdheight_zero_2.dump 2022-08-28
12:56:23.719964845 +0100
***************
*** 0 ****
--- 1,6 ----
+ |s+0&#e0e0e08|o|m|e| >t+0&#ffffff0|e|x|t| @65
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
*** ../vim-9.0.0293/src/testdir/dumps/Test_cmdheight_zero_3.dump
2022-08-28 13:01:32.391815274 +0100
--- src/testdir/dumps/Test_cmdheight_zero_3.dump 2022-08-28
12:57:31.435935621 +0100
***************
*** 0 ****
--- 1,6 ----
+ |s+0&#ffffff0|o|m|e| >t|e|x|t| @65
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ |═+0#e000002&@74
+ |m|e|s@1|a|g|e| |w|i|n|d|o|w| @60
*** ../vim-9.0.0293/src/version.c 2022-08-28 12:06:17.816288642 +0100
--- src/version.c 2022-08-28 12:38:25.712289373 +0100
***************
*** 709,710 ****
--- 709,712 ----
{ /* Add new patch number below this line */
+ /**/
+ 294,
/**/
--
Why is "abbreviation" such a long word?
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
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 on the web visit
https://groups.google.com/d/msgid/vim_dev/20220828120315.71EDE1C07CD%40moolenaar.net.