mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Problem: Using :echowin while at the hit-enter prompt causes problems. Solution: Do not prompt for :echowin. Postpone showing the message window. Start the timer when the window is displayed.
This commit is contained in:
@@ -3890,7 +3890,8 @@ redrawcmd(void)
|
|||||||
void
|
void
|
||||||
compute_cmdrow(void)
|
compute_cmdrow(void)
|
||||||
{
|
{
|
||||||
if (exmode_active || msg_scrolled != 0)
|
// ignore "msg_scrolled" in update_screen(), it will be reset soon.
|
||||||
|
if (exmode_active || (msg_scrolled != 0 && !updating_screen))
|
||||||
cmdline_row = Rows - 1;
|
cmdline_row = Rows - 1;
|
||||||
else
|
else
|
||||||
cmdline_row = W_WINROW(lastwin) + lastwin->w_height
|
cmdline_row = W_WINROW(lastwin) + lastwin->w_height
|
||||||
|
@@ -1157,6 +1157,10 @@ wait_return(int redraw)
|
|||||||
// need_wait_return to do it later.
|
// need_wait_return to do it later.
|
||||||
if (msg_silent != 0)
|
if (msg_silent != 0)
|
||||||
return;
|
return;
|
||||||
|
#ifdef HAS_MESSAGE_WINDOW
|
||||||
|
if (in_echowindow)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When inside vgetc(), we can't wait for a typed character at all.
|
* When inside vgetc(), we can't wait for a typed character at all.
|
||||||
|
@@ -31,6 +31,13 @@ static poppos_entry_T poppos_entries[] = {
|
|||||||
#ifdef HAS_MESSAGE_WINDOW
|
#ifdef HAS_MESSAGE_WINDOW
|
||||||
// Window used for ":echowindow"
|
// Window used for ":echowindow"
|
||||||
static win_T *message_win = NULL;
|
static win_T *message_win = NULL;
|
||||||
|
|
||||||
|
// Flag set when a message is added to the message window, timer is started
|
||||||
|
// when the message window is drawn. This might be after pressing Enter at the
|
||||||
|
// hit-enter prompt.
|
||||||
|
static int start_message_win_timer = FALSE;
|
||||||
|
|
||||||
|
static void may_start_message_win_timer(win_T *wp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void popup_adjust_position(win_T *wp);
|
static void popup_adjust_position(win_T *wp);
|
||||||
@@ -4268,6 +4275,11 @@ update_popups(void (*win_update)(win_T *wp))
|
|||||||
|
|
||||||
// Back to the normal zindex.
|
// Back to the normal zindex.
|
||||||
screen_zindex = 0;
|
screen_zindex = 0;
|
||||||
|
|
||||||
|
#ifdef HAS_MESSAGE_WINDOW
|
||||||
|
// if this was the message window popup may start the timer now
|
||||||
|
may_start_message_win_timer(wp);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FEAT_SEARCH_EXTRA)
|
#if defined(FEAT_SEARCH_EXTRA)
|
||||||
@@ -4513,8 +4525,18 @@ popup_show_message_win(void)
|
|||||||
popup_update_color(message_win, TYPE_MESSAGE_WIN);
|
popup_update_color(message_win, TYPE_MESSAGE_WIN);
|
||||||
popup_show(message_win);
|
popup_show(message_win);
|
||||||
}
|
}
|
||||||
|
start_message_win_timer = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
may_start_message_win_timer(win_T *wp)
|
||||||
|
{
|
||||||
|
if (wp == message_win && start_message_win_timer)
|
||||||
|
{
|
||||||
if (message_win->w_popup_timer != NULL)
|
if (message_win->w_popup_timer != NULL)
|
||||||
timer_start(message_win->w_popup_timer);
|
timer_start(message_win->w_popup_timer);
|
||||||
|
start_message_win_timer = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4552,8 +4574,9 @@ end_echowindow(void)
|
|||||||
{
|
{
|
||||||
in_echowindow = FALSE;
|
in_echowindow = FALSE;
|
||||||
|
|
||||||
// show the message window now
|
if ((State & MODE_HITRETURN) == 0)
|
||||||
redraw_cmd(FALSE);
|
// show the message window now
|
||||||
|
redraw_cmd(FALSE);
|
||||||
|
|
||||||
// do not overwrite messages
|
// do not overwrite messages
|
||||||
// TODO: only for message window
|
// TODO: only for message window
|
||||||
|
@@ -3038,18 +3038,18 @@ screenclear2(int doclear)
|
|||||||
screen_cleared = TRUE; // can use contents of ScreenLines now
|
screen_cleared = TRUE; // can use contents of ScreenLines now
|
||||||
|
|
||||||
win_rest_invalid(firstwin); // redraw all regular windows
|
win_rest_invalid(firstwin); // redraw all regular windows
|
||||||
#ifdef FEAT_PROP_POPUP
|
|
||||||
popup_redraw_all(); // redraw all popup windows
|
|
||||||
#endif
|
|
||||||
redraw_cmdline = TRUE;
|
redraw_cmdline = TRUE;
|
||||||
redraw_tabline = TRUE;
|
redraw_tabline = TRUE;
|
||||||
if (must_redraw == UPD_CLEAR) // no need to clear again
|
if (must_redraw == UPD_CLEAR) // no need to clear again
|
||||||
must_redraw = UPD_NOT_VALID;
|
must_redraw = UPD_NOT_VALID;
|
||||||
|
msg_scrolled = 0; // compute_cmdrow() uses this
|
||||||
compute_cmdrow();
|
compute_cmdrow();
|
||||||
|
#ifdef FEAT_PROP_POPUP
|
||||||
|
popup_redraw_all(); // redraw all popup windows
|
||||||
|
#endif
|
||||||
msg_row = cmdline_row; // put cursor on last line for messages
|
msg_row = cmdline_row; // put cursor on last line for messages
|
||||||
msg_col = 0;
|
msg_col = 0;
|
||||||
screen_start(); // don't know where cursor is now
|
screen_start(); // don't know where cursor is now
|
||||||
msg_scrolled = 0; // can't scroll back
|
|
||||||
msg_didany = FALSE;
|
msg_didany = FALSE;
|
||||||
msg_didout = FALSE;
|
msg_didout = FALSE;
|
||||||
}
|
}
|
||||||
|
8
src/testdir/dumps/Test_echowindow_6.dump
Normal file
8
src/testdir/dumps/Test_echowindow_6.dump
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
|~+0#4040ff13#ffffff0| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|o+0#0000000&|n|e| @71
|
||||||
|
|t|w|o| @71
|
||||||
|
|t|h|r|e@1| @69
|
||||||
|
|P+0#00e0003&|r|e|s@1| |E|N|T|E|R| |o|r| |t|y|p|e| |c|o|m@1|a|n|d| |t|o| |c|o|n|t|i|n|u|e> +0#0000000&@35
|
8
src/testdir/dumps/Test_echowindow_7.dump
Normal file
8
src/testdir/dumps/Test_echowindow_7.dump
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
>s+0&#ffffff0|o|m|e| |t|e|x|t| @65
|
||||||
|
|~+0#4040ff13&| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|═+0#e000002&@74
|
||||||
|
|l|a|t|e|r| |m|e|s@1|a|g|e| @61
|
||||||
|
| +0#0000000&@74
|
||||||
|
@57|1|,|1| @10|A|l@1|
|
@@ -401,6 +401,28 @@ func Test_echowindow()
|
|||||||
echowindow 'line' n
|
echowindow 'line' n
|
||||||
endfor
|
endfor
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
def TwoMessages()
|
||||||
|
popup_clear()
|
||||||
|
set cmdheight=2
|
||||||
|
redraw
|
||||||
|
timer_start(100, (_) => {
|
||||||
|
echowin 'message'
|
||||||
|
})
|
||||||
|
echo 'one'
|
||||||
|
echo 'two'
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def ThreeMessages()
|
||||||
|
popup_clear()
|
||||||
|
redraw
|
||||||
|
timer_start(100, (_) => {
|
||||||
|
echowin 'later message'
|
||||||
|
})
|
||||||
|
echo 'one'
|
||||||
|
echo 'two'
|
||||||
|
echo 'three'
|
||||||
|
enddef
|
||||||
END
|
END
|
||||||
call writefile(lines, 'XtestEchowindow')
|
call writefile(lines, 'XtestEchowindow')
|
||||||
let buf = RunVimInTerminal('-S XtestEchowindow', #{rows: 8})
|
let buf = RunVimInTerminal('-S XtestEchowindow', #{rows: 8})
|
||||||
@@ -415,6 +437,16 @@ func Test_echowindow()
|
|||||||
call term_sendkeys(buf, ":call ManyMessages()\<CR>")
|
call term_sendkeys(buf, ":call ManyMessages()\<CR>")
|
||||||
call VerifyScreenDump(buf, 'Test_echowindow_4', {})
|
call VerifyScreenDump(buf, 'Test_echowindow_4', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, ":call TwoMessages()\<CR>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_echowindow_5', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, ":call ThreeMessages()\<CR>")
|
||||||
|
sleep 120m
|
||||||
|
call VerifyScreenDump(buf, 'Test_echowindow_6', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, "\<CR>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_echowindow_7', {})
|
||||||
|
|
||||||
" clean up
|
" clean up
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
call delete('XtestEchowindow')
|
call delete('XtestEchowindow')
|
||||||
|
@@ -703,6 +703,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
447,
|
||||||
/**/
|
/**/
|
||||||
446,
|
446,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user