mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
cmdline: Redraw the cmdline after processing events
vim-patch:7.4.1603 TODO(bfredl): if we allow events in HITRETURN and ASKMORE states, we need to add the necessary redraws as well.
This commit is contained in:
parent
61e8adb25e
commit
5cc87d4dab
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
9
third-party/cmake/BuildLuarocks.cmake
vendored
9
third-party/cmake/BuildLuarocks.cmake
vendored
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user