Mercurial > vim
diff src/getchar.c @ 18116:7f57ea9a4ba8 v8.1.2053
patch 8.1.2053: SafeStateAgain not triggered if callback uses feedkeys()
Commit: https://github.com/vim/vim/commit/d103ee78432f9036d243b18dd5aac1263d3b7dc9
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Sep 18 21:15:31 2019 +0200
patch 8.1.2053: SafeStateAgain not triggered if callback uses feedkeys()
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().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 18 Sep 2019 21:30:03 +0200 |
parents | b456bba1276a |
children | f31b0ac6e175 |
line wrap: on
line diff
--- 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;