summaryrefslogtreecommitdiffstats
path: root/src/getchar.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-09-18 21:15:31 +0200
committerBram Moolenaar <Bram@vim.org>2019-09-18 21:15:31 +0200
commitd103ee78432f9036d243b18dd5aac1263d3b7dc9 (patch)
tree5b63ac38b27bdf3459ef73f82eff2b2376da41c1 /src/getchar.c
parent7a9bd7c1e0ce1baf5a02daf36eeae3638aa315c7 (diff)
patch 8.1.2053: SafeStateAgain not triggered if callback uses feedkeys()v8.1.2053
Problem: SafeStateAgain not triggered if callback uses feedkeys(). Solution: Check for safe state in the input loop. Make log messages easier to find. Add 'S' flag to state().
Diffstat (limited to 'src/getchar.c')
-rw-r--r--src/getchar.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/getchar.c b/src/getchar.c
index 93d0d64ee0..1056e938ed 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -933,7 +933,7 @@ ins_typebuf(
init_typebuf();
if (++typebuf.tb_change_cnt == 0)
typebuf.tb_change_cnt = 1;
- state_no_longer_safe();
+ state_no_longer_safe("ins_typebuf()");
addlen = (int)STRLEN(str);
@@ -1797,7 +1797,7 @@ vgetc(void)
// Need to process the character before we know it's safe to do something
// else.
if (c != K_IGNORE)
- state_no_longer_safe();
+ state_no_longer_safe("key typed");
return c;
}
@@ -2047,6 +2047,7 @@ parse_queued_messages(void)
int i;
int save_may_garbage_collect = may_garbage_collect;
static int entered = 0;
+ int was_safe = get_was_safe_state();
// Do not handle messages while redrawing, because it may cause buffers to
// change or be wiped while they are being redrawn.
@@ -2102,7 +2103,7 @@ parse_queued_messages(void)
// When not nested we'll go back to waiting for a typed character. If it
// was safe before then this triggers a SafeStateAgain autocommand event.
- if (entered == 1)
+ if (entered == 1 && was_safe)
may_trigger_safestateagain();
may_garbage_collect = save_may_garbage_collect;