mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 13:38:34 +00:00
terminal: block redraw during c_CTRL-D
Unlike the normal wildmenu, the CTRL-D wild-list is not restored by statusline redraw. (Semantics: ^D is controlled by 'wildoptions' option, so it's in the "wild..." family.) TODO: externalize the c_CTRL-D wild-list.
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#include "nvim/assert.h"
|
#include "nvim/assert.h"
|
||||||
|
#include "nvim/log.h"
|
||||||
#include "nvim/vim.h"
|
#include "nvim/vim.h"
|
||||||
#include "nvim/ascii.h"
|
#include "nvim/ascii.h"
|
||||||
#include "nvim/arabic.h"
|
#include "nvim/arabic.h"
|
||||||
@@ -472,11 +473,12 @@ static int command_line_execute(VimState *state, int key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// free expanded names when finished walking through matches
|
// free expanded names when finished walking through matches
|
||||||
if (s->xpc.xp_numfiles != -1
|
if (!(s->c == p_wc && KeyTyped) && s->c != p_wcm
|
||||||
&& !(s->c == p_wc && KeyTyped) && s->c != p_wcm
|
|
||||||
&& s->c != Ctrl_N && s->c != Ctrl_P && s->c != Ctrl_A
|
&& s->c != Ctrl_N && s->c != Ctrl_P && s->c != Ctrl_A
|
||||||
&& s->c != Ctrl_L) {
|
&& s->c != Ctrl_L) {
|
||||||
(void)ExpandOne(&s->xpc, NULL, NULL, 0, WILD_FREE);
|
if (s->xpc.xp_numfiles != -1) {
|
||||||
|
(void)ExpandOne(&s->xpc, NULL, NULL, 0, WILD_FREE);
|
||||||
|
}
|
||||||
s->did_wild_list = false;
|
s->did_wild_list = false;
|
||||||
if (!p_wmnu || (s->c != K_UP && s->c != K_DOWN)) {
|
if (!p_wmnu || (s->c != K_UP && s->c != K_DOWN)) {
|
||||||
s->xpc.xp_context = EXPAND_NOTHING;
|
s->xpc.xp_context = EXPAND_NOTHING;
|
||||||
@@ -1222,6 +1224,7 @@ static int command_line_handle_key(CommandLineState *s)
|
|||||||
break; // Use ^D as normal char instead
|
break; // Use ^D as normal char instead
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wild_menu_showing = WM_LIST;
|
||||||
redrawcmd();
|
redrawcmd();
|
||||||
return 1; // don't do incremental search now
|
return 1; // don't do incremental search now
|
||||||
|
|
||||||
|
@@ -931,8 +931,11 @@ EXTERN char_u langmap_mapchar[256]; /* mapping for language keys */
|
|||||||
EXTERN int save_p_ls INIT(= -1); /* Save 'laststatus' setting */
|
EXTERN int save_p_ls INIT(= -1); /* Save 'laststatus' setting */
|
||||||
EXTERN int save_p_wmh INIT(= -1); /* Save 'winminheight' setting */
|
EXTERN int save_p_wmh INIT(= -1); /* Save 'winminheight' setting */
|
||||||
EXTERN int wild_menu_showing INIT(= 0);
|
EXTERN int wild_menu_showing INIT(= 0);
|
||||||
# define WM_SHOWN 1 /* wildmenu showing */
|
enum {
|
||||||
# define WM_SCROLLED 2 /* wildmenu showing with scroll */
|
WM_SHOWN = 1, ///< wildmenu showing
|
||||||
|
WM_SCROLLED = 2, ///< wildmenu showing with scroll
|
||||||
|
WM_LIST = 3, ///< cmdline CTRL-D
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
EXTERN char breakat_flags[256]; /* which characters are in 'breakat' */
|
EXTERN char breakat_flags[256]; /* which characters are in 'breakat' */
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
#include "nvim/lib/kvec.h"
|
#include "nvim/lib/kvec.h"
|
||||||
|
|
||||||
#include "nvim/ascii.h"
|
#include "nvim/ascii.h"
|
||||||
|
#include "nvim/log.h"
|
||||||
#include "nvim/state.h"
|
#include "nvim/state.h"
|
||||||
#include "nvim/vim.h"
|
#include "nvim/vim.h"
|
||||||
#include "nvim/main.h"
|
#include "nvim/main.h"
|
||||||
|
@@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
#include <vterm.h>
|
#include <vterm.h>
|
||||||
|
|
||||||
|
#include "nvim/log.h"
|
||||||
#include "nvim/vim.h"
|
#include "nvim/vim.h"
|
||||||
#include "nvim/terminal.h"
|
#include "nvim/terminal.h"
|
||||||
#include "nvim/message.h"
|
#include "nvim/message.h"
|
||||||
@@ -1010,7 +1011,10 @@ static void refresh_terminal(Terminal *term)
|
|||||||
// Calls refresh_terminal() on all invalidated_terminals.
|
// Calls refresh_terminal() on all invalidated_terminals.
|
||||||
static void refresh_timer_cb(TimeWatcher *watcher, void *data)
|
static void refresh_timer_cb(TimeWatcher *watcher, void *data)
|
||||||
{
|
{
|
||||||
if (exiting) { // Cannot redraw (requires event loop) during teardown/exit.
|
if (exiting // Cannot redraw (requires event loop) during teardown/exit.
|
||||||
|
// WM_LIST (^D) is not redrawn, unlike the normal wildmenu. So we must
|
||||||
|
// skip redraws to keep it visible.
|
||||||
|
|| wild_menu_showing == WM_LIST) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
Terminal *term;
|
Terminal *term;
|
||||||
|
@@ -66,10 +66,10 @@ describe("'wildmenu'", function()
|
|||||||
else
|
else
|
||||||
feed([[:terminal for i in $(seq 1 5000); do printf 'foo\nfoo\nfoo\n'; sleep 0.1; done<cr>]])
|
feed([[:terminal for i in $(seq 1 5000); do printf 'foo\nfoo\nfoo\n'; sleep 0.1; done<cr>]])
|
||||||
end
|
end
|
||||||
screen:sleep(50) -- Allow some output.
|
|
||||||
feed([[<C-\><C-N>gg]])
|
feed([[<C-\><C-N>gg]])
|
||||||
feed([[:sign <Tab>]]) -- Invoke wildmenu.
|
feed([[:sign <Tab>]]) -- Invoke wildmenu.
|
||||||
screen:sleep(50) -- Allow some output.
|
screen:sleep(50) -- Allow some terminal output.
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
foo |
|
foo |
|
||||||
foo |
|
foo |
|
||||||
@@ -77,6 +77,28 @@ describe("'wildmenu'", function()
|
|||||||
define jump list > |
|
define jump list > |
|
||||||
:sign define^ |
|
:sign define^ |
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
-- cmdline CTRL-D display should also be preserved.
|
||||||
|
feed([[<C-\><C-N>]])
|
||||||
|
feed([[:sign <C-D>]]) -- Invoke cmdline CTRL-D.
|
||||||
|
screen:sleep(50) -- Allow some terminal output.
|
||||||
|
screen:expect([[
|
||||||
|
:sign |
|
||||||
|
define place |
|
||||||
|
jump undefine |
|
||||||
|
list unplace |
|
||||||
|
:sign ^ |
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- Exiting cmdline should show the buffer.
|
||||||
|
feed([[<C-\><C-N>]])
|
||||||
|
screen:expect([[
|
||||||
|
^foo |
|
||||||
|
foo |
|
||||||
|
foo |
|
||||||
|
foo |
|
||||||
|
|
|
||||||
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('ignores :redrawstatus called from a timer #7108', function()
|
it('ignores :redrawstatus called from a timer #7108', function()
|
||||||
|
Reference in New Issue
Block a user