diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-06-07 22:04:52 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-06-07 22:04:52 +0200 |
commit | c41badb748bbaa78cbadfcda9ca965e8a283fb9b (patch) | |
tree | 01240bdb613c21b0b5648361c7716032ebff49ec /src/ui.c | |
parent | 8cf02e5cf8fb14a5009f12e7af0a47617a0ce88d (diff) | |
download | vim-git-c41badb748bbaa78cbadfcda9ca965e8a283fb9b.tar.gz |
patch 8.2.2961: keys typed during a :normal command are discardedv8.2.2961
Problem: Keys typed during a :normal command are discarded.
Solution: Concatenate saved typeahead and typed kesy. (closes #8340)
Diffstat (limited to 'src/ui.c')
-rw-r--r-- | src/ui.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -810,9 +810,10 @@ get_input_buf(void) /* * Restore the input buffer with a pointer returned from get_input_buf(). * The allocated memory is freed, this only works once! + * When "overwrite" is FALSE input typed later is kept. */ void -set_input_buf(char_u *p) +set_input_buf(char_u *p, int overwrite) { garray_T *gap = (garray_T *)p; @@ -820,8 +821,17 @@ set_input_buf(char_u *p) { if (gap->ga_data != NULL) { - mch_memmove(inbuf, gap->ga_data, gap->ga_len); - inbufcount = gap->ga_len; + if (overwrite || inbufcount + gap->ga_len >= INBUFLEN) + { + mch_memmove(inbuf, gap->ga_data, gap->ga_len); + inbufcount = gap->ga_len; + } + else + { + mch_memmove(inbuf + gap->ga_len, inbuf, inbufcount); + mch_memmove(inbuf, gap->ga_data, gap->ga_len); + inbufcount += gap->ga_len; + } vim_free(gap->ga_data); } vim_free(gap); |