diff options
-rw-r--r-- | src/nvim/ex_getln.c | 3 | ||||
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 34 |
2 files changed, 33 insertions, 4 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 9bfa9e22df..fd7ad7a4b5 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -441,7 +441,8 @@ static int command_line_execute(VimState *state, int key) if (s->c == K_EVENT) { multiqueue_process_events(main_loop.events); - return command_line_not_changed(s); + redrawcmdline(); + return 1; } if (KeyTyped) { diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 2621568a71..00a47e1ed0 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -260,8 +260,8 @@ describe('tui FocusGained/FocusLost', function() end) end) - -- per 5cc87d4dabd02167117be7a978b5c8faaa975419 we decided to ignore :echo - -- invoked from timers/events while the user is in cmdline-mode. + -- During cmdline-mode we ignore :echo invoked by timers/events. + -- See commit: 5cc87d4dabd02167117be7a978b5c8faaa975419. it('in cmdline-mode does NOT :echo', function() feed_data(':') feed_data('\027[I') @@ -286,7 +286,35 @@ describe('tui FocusGained/FocusLost', function() ]]) end) - it('can handle focus events in terminal mode', function() + it('in cmdline-mode', function() + -- Set up autocmds that modify the buffer, instead of just calling :echo. + -- This is how we can test handling of focus gained/lost during cmdline-mode. + -- See commit: 5cc87d4dabd02167117be7a978b5c8faaa975419. + feed_data(":autocmd!\n") + feed_data(":autocmd FocusLost * call append(line('$'), 'lost')\n") + feed_data(":autocmd FocusGained * call append(line('$'), 'gained')\n") + -- Enter cmdline-mode. + feed_data(':') + screen:sleep(10) + -- Send focus lost/gained termcodes. + feed_data('\027[O') + feed_data('\027[I') + screen:sleep(10) + -- Exit cmdline-mode. Redraws from timers/events are blocked during + -- cmdline-mode, so the buffer won't be updated until we exit cmdline-mode. + feed_data('\n') + screen:expect([[ + {1: } | + lost | + gained | + {4:~ }| + {5:[No Name] [+] }| + : | + {3:-- TERMINAL --} | + ]]) + end) + + it('in terminal-mode', function() feed_data(':set shell='..nvim_dir..'/shell-test\n') feed_data(':set noshowmode laststatus=0\n') |