Mercurial > vim
diff src/ui.c @ 24846:fdc6a7769045 v8.2.2961
patch 8.2.2961: keys typed during a :normal command are discarded
Commit: https://github.com/vim/vim/commit/c41badb748bbaa78cbadfcda9ca965e8a283fb9b
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jun 7 22:04:52 2021 +0200
patch 8.2.2961: keys typed during a :normal command are discarded
Problem: Keys typed during a :normal command are discarded.
Solution: Concatenate saved typeahead and typed kesy. (closes https://github.com/vim/vim/issues/8340)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 07 Jun 2021 22:15:04 +0200 |
parents | 1040b294bfd3 |
children | aa55d6d17625 |
line wrap: on
line diff
--- a/src/ui.c +++ b/src/ui.c @@ -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);