aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/ex_getln.c1
-rw-r--r--src/nvim/message.c24
-rw-r--r--test/functional/eval/timer_spec.lua23
-rw-r--r--test/functional/ui/screen.lua6
-rw-r--r--third-party/cmake/BuildLuarocks.cmake9
5 files changed, 56 insertions, 7 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index a4e5a4dcd7..db21fddedb 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -359,6 +359,7 @@ static int command_line_execute(VimState *state, int key)
if (s->c == K_EVENT) {
queue_process_events(loop.events);
+ redrawcmdline();
return 1;
}
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 47f246fc76..521db85cf0 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -785,11 +785,13 @@ void wait_return(int redraw)
State = HITRETURN;
setmouse();
- /* Avoid the sequence that the user types ":" at the hit-return prompt
- * to start an Ex command, but the file-changed dialog gets in the
- * way. */
- if (need_check_timestamps)
- check_timestamps(FALSE);
+ cmdline_row = msg_row;
+ // Avoid the sequence that the user types ":" at the hit-return prompt
+ // to start an Ex command, but the file-changed dialog gets in the
+ // way.
+ if (need_check_timestamps) {
+ check_timestamps(false);
+ }
hit_return_msg();
@@ -1970,6 +1972,7 @@ static void msg_puts_printf(char *str, int maxlen)
*/
static int do_more_prompt(int typed_char)
{
+ static bool entered = false;
int used_typed_char = typed_char;
int oldState = State;
int c;
@@ -1979,6 +1982,13 @@ static int do_more_prompt(int typed_char)
msgchunk_T *mp;
int i;
+ // We get called recursively when a timer callback outputs a message. In
+ // that case don't show another prompt. Also when at the hit-Enter prompt.
+ if (entered || State == HITRETURN) {
+ return false;
+ }
+ entered = true;
+
if (typed_char == 'G') {
/* "g<": Find first line on the last page. */
mp_last = msg_sb_start(last_msgchunk);
@@ -2153,9 +2163,11 @@ static int do_more_prompt(int typed_char)
if (quit_more) {
msg_row = Rows - 1;
msg_col = 0;
- } else if (cmdmsg_rl)
+ } else if (cmdmsg_rl) {
msg_col = Columns - 1;
+ }
+ entered = false;
return retval;
}
diff --git a/test/functional/eval/timer_spec.lua b/test/functional/eval/timer_spec.lua
index df0a55e462..611113f560 100644
--- a/test/functional/eval/timer_spec.lua
+++ b/test/functional/eval/timer_spec.lua
@@ -1,4 +1,5 @@
local helpers = require('test.functional.helpers')
+local Screen = require('test.functional.ui.screen')
local ok, feed, eq, eval = helpers.ok, helpers.feed, helpers.eq, helpers.eval
local source, nvim_async, run = helpers.source, helpers.nvim_async, helpers.run
local clear, execute, funcs = helpers.clear, helpers.execute, helpers.funcs
@@ -103,4 +104,26 @@ describe('timers', function()
eq(2,eval("g:val2"))
end)
+ it("doesn't mess up the cmdline", function()
+ local screen = Screen.new(40, 6)
+ screen:attach()
+ screen:set_default_attr_ignore({{bold=true, foreground=Screen.colors.Blue}})
+ source([[
+ func! MyHandler(timer)
+ echo "evil"
+ endfunc
+ ]])
+ execute("call timer_start(100, 'MyHandler', {'repeat': 1})")
+ feed(":good")
+ screen:sleep(200)
+ screen:expect([[
+ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ :good^ |
+ ]])
+ end)
+
end)
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index 6372cbe081..99b85caf10 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -290,6 +290,10 @@ If everything else fails, use Screen:redraw_debug to help investigate what is
end
end
+function Screen:sleep(ms)
+ pcall(function() self:wait(function() return "error" end, ms) end)
+end
+
function Screen:_redraw(updates)
for _, update in ipairs(updates) do
-- print('--')
@@ -501,7 +505,7 @@ end
function Screen:snapshot_util(attrs, ignore)
-- util to generate screen test
- pcall(function() self:wait(function() return "error" end, 250) end)
+ self:sleep(250)
self:print_snapshot(attrs, ignore)
end
diff --git a/third-party/cmake/BuildLuarocks.cmake b/third-party/cmake/BuildLuarocks.cmake
index 1662f89b24..069c94ea2e 100644
--- a/third-party/cmake/BuildLuarocks.cmake
+++ b/third-party/cmake/BuildLuarocks.cmake
@@ -114,6 +114,15 @@ add_custom_target(lpeg
list(APPEND THIRD_PARTY_DEPS lpeg)
+add_custom_command(OUTPUT ${HOSTDEPS_LIB_DIR}/luarocks/rocks/inspect
+ COMMAND ${LUAROCKS_BINARY}
+ ARGS build inspect ${LUAROCKS_BUILDARGS}
+ DEPENDS mpack)
+add_custom_target(inspect
+ DEPENDS ${HOSTDEPS_LIB_DIR}/luarocks/rocks/inspect)
+
+list(APPEND THIRD_PARTY_DEPS inspect)
+
if(USE_BUNDLED_BUSTED)
add_custom_command(OUTPUT ${HOSTDEPS_BIN_DIR}/busted
COMMAND ${LUAROCKS_BINARY}