aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/getchar.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-11-14 04:16:13 +0100
committerJustin M. Keyes <justinkz@gmail.com>2016-11-15 04:22:24 +0100
commit91507c271e9e51cefed3dcac21f7a41b9cac0bbe (patch)
tree27e530cf607969e1b93fa4d8a30814934ae1b693 /src/nvim/getchar.c
parent4539d867d491c9ca748f3d2de505092c4769824d (diff)
downloadrneovim-91507c271e9e51cefed3dcac21f7a41b9cac0bbe.tar.gz
rneovim-91507c271e9e51cefed3dcac21f7a41b9cac0bbe.tar.bz2
rneovim-91507c271e9e51cefed3dcac21f7a41b9cac0bbe.zip
'inccommand': Detect "non-interactive", "too slow".
command_line_changed: - Check (current_SID == 0) instead of KeyTyped - We want to update during mappings (KeyTyped is false then). - Check vpeekc_any() - Avoids unnecessary work. - Avoids triggering live preview during macros. - Caveat: This makes the redraw "stutter" if user spams (holds a key) in the replace pattern. But that scenario is not important. - Update screen if the command is changed to a non-live command. (`s->live` goes from true => false) => clears the preview command_line_execute: - Let CTRL-C cancel live preview do_sub: - Enforce a time limit ('redrawtime'). - Unset 'inccommand' if time limit is reached. Closes #5602 Closes #5585
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r--src/nvim/getchar.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index dad0ac33cd..ab52ee0372 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -1583,29 +1583,27 @@ vungetc ( /* unget one character (can only be done once!) */
old_mouse_col = mouse_col;
}
-/*
- * get a character:
- * 1. from the stuffbuffer
- * This is used for abbreviated commands like "D" -> "d$".
- * Also used to redo a command for ".".
- * 2. from the typeahead buffer
- * Stores text obtained previously but not used yet.
- * Also stores the result of mappings.
- * Also used for the ":normal" command.
- * 3. from the user
- * This may do a blocking wait if "advance" is TRUE.
- *
- * if "advance" is TRUE (vgetc()):
- * really get the character.
- * KeyTyped is set to TRUE in the case the user typed the key.
- * KeyStuffed is TRUE if the character comes from the stuff buffer.
- * if "advance" is FALSE (vpeekc()):
- * just look whether there is a character available.
- *
- * When "no_mapping" is zero, checks for mappings in the current mode.
- * Only returns one byte (of a multi-byte character).
- * K_SPECIAL and CSI may be escaped, need to get two more bytes then.
- */
+/// get a character:
+/// 1. from the stuffbuffer
+/// This is used for abbreviated commands like "D" -> "d$".
+/// Also used to redo a command for ".".
+/// 2. from the typeahead buffer
+/// Stores text obtained previously but not used yet.
+/// Also stores the result of mappings.
+/// Also used for the ":normal" command.
+/// 3. from the user
+/// This may do a blocking wait if "advance" is TRUE.
+///
+/// if "advance" is TRUE (vgetc()):
+/// really get the character.
+/// KeyTyped is set to TRUE in the case the user typed the key.
+/// KeyStuffed is TRUE if the character comes from the stuff buffer.
+/// if "advance" is FALSE (vpeekc()):
+/// just look whether there is a character available.
+///
+/// When "no_mapping" is zero, checks for mappings in the current mode.
+/// Only returns one byte (of a multi-byte character).
+/// K_SPECIAL and CSI may be escaped, need to get two more bytes then.
static int vgetorpeek(int advance)
{
int c, c1;