Patch 8.2.2961
Problem: Keys typed during a :normal command are discarded.
Solution: Concatenate saved typeahead and typed kesy. (closes #8340)
Files: src/getchar.c, src/proto/getchar.pro, src/ex_docmd.c,
src/evalfunc.c, src/debugger.c, src/ui.c, src/proto/ui.pro
*** ../vim-8.2.2960/src/getchar.c 2021-06-07 18:27:35.900235056 +0200
--- src/getchar.c 2021-06-07 21:58:16.187410298 +0200
***************
*** 1414,1422 ****
/*
* Restore the typeahead to what it was before calling save_typeahead().
* The allocated memory is freed, can only be called once!
*/
void
! restore_typeahead(tasave_T *tp)
{
if (tp->typebuf_valid)
{
--- 1414,1423 ----
/*
* Restore the typeahead to what it was before calling save_typeahead().
* The allocated memory is freed, can only be called once!
+ * When "overwrite" is FALSE input typed later is kept.
*/
void
! restore_typeahead(tasave_T *tp, int overwrite UNUSED)
{
if (tp->typebuf_valid)
{
***************
*** 1432,1438 ****
free_buff(&readbuf2);
readbuf2 = tp->save_readbuf2;
# ifdef USE_INPUT_BUF
! set_input_buf(tp->save_inputbuf);
# endif
}
--- 1433,1439 ----
free_buff(&readbuf2);
readbuf2 = tp->save_readbuf2;
# ifdef USE_INPUT_BUF
! set_input_buf(tp->save_inputbuf, overwrite);
# endif
}
*** ../vim-8.2.2960/src/proto/getchar.pro 2021-06-07 18:27:35.900235056
+0200
--- src/proto/getchar.pro 2021-06-07 22:02:20.558923336 +0200
***************
*** 32,38 ****
void del_typebuf(int len, int offset);
int save_typebuf(void);
void save_typeahead(tasave_T *tp);
! void restore_typeahead(tasave_T *tp);
void openscript(char_u *name, int directly);
void close_all_scripts(void);
int using_script(void);
--- 32,38 ----
void del_typebuf(int len, int offset);
int save_typebuf(void);
void save_typeahead(tasave_T *tp);
! void restore_typeahead(tasave_T *tp, int overwrite);
void openscript(char_u *name, int directly);
void close_all_scripts(void);
int using_script(void);
*** ../vim-8.2.2960/src/ex_docmd.c 2021-06-06 21:38:04.941344567 +0200
--- src/ex_docmd.c 2021-06-07 21:57:20.999519974 +0200
***************
*** 8249,8255 ****
restore_current_state(save_state_T *sst)
{
// Restore the previous typeahead.
! restore_typeahead(&sst->tabuf);
msg_scroll = sst->save_msg_scroll;
restart_edit = sst->save_restart_edit;
--- 8249,8255 ----
restore_current_state(save_state_T *sst)
{
// Restore the previous typeahead.
! restore_typeahead(&sst->tabuf, FALSE);
msg_scroll = sst->save_msg_scroll;
restart_edit = sst->save_restart_edit;
*** ../vim-8.2.2960/src/evalfunc.c 2021-06-07 18:27:35.900235056 +0200
--- src/evalfunc.c 2021-06-07 21:58:37.423368060 +0200
***************
*** 5873,5879 ****
{
--ga_userinput.ga_len;
restore_typeahead((tasave_T *)(ga_userinput.ga_data)
! + ga_userinput.ga_len);
// default return is zero == OK
}
else if (p_verbose > 1)
--- 5873,5879 ----
{
--ga_userinput.ga_len;
restore_typeahead((tasave_T *)(ga_userinput.ga_data)
! + ga_userinput.ga_len, TRUE);
// default return is zero == OK
}
else if (p_verbose > 1)
*** ../vim-8.2.2960/src/debugger.c 2021-01-31 13:08:16.164367438 +0100
--- src/debugger.c 2021-06-07 21:58:28.647385518 +0200
***************
*** 140,146 ****
if (typeahead_saved)
{
! restore_typeahead(&typeaheadbuf);
ignore_script = save_ignore_script;
}
ex_normal_busy = save_ex_normal_busy;
--- 140,146 ----
if (typeahead_saved)
{
! restore_typeahead(&typeaheadbuf, TRUE);
ignore_script = save_ignore_script;
}
ex_normal_busy = save_ex_normal_busy;
*** ../vim-8.2.2960/src/ui.c 2021-03-22 16:45:32.520949562 +0100
--- src/ui.c 2021-06-07 22:03:45.198754222 +0200
***************
*** 810,818 ****
/*
* Restore the input buffer with a pointer returned from get_input_buf().
* The allocated memory is freed, this only works once!
*/
void
! set_input_buf(char_u *p)
{
garray_T *gap = (garray_T *)p;
--- 810,819 ----
/*
* 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, int overwrite)
{
garray_T *gap = (garray_T *)p;
***************
*** 820,827 ****
{
if (gap->ga_data != NULL)
{
! mch_memmove(inbuf, gap->ga_data, gap->ga_len);
! inbufcount = gap->ga_len;
vim_free(gap->ga_data);
}
vim_free(gap);
--- 821,837 ----
{
if (gap->ga_data != NULL)
{
! 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);
*** ../vim-8.2.2960/src/proto/ui.pro 2021-03-22 16:19:37.529354296 +0100
--- src/proto/ui.pro 2021-06-07 22:01:59.342965715 +0200
***************
*** 19,25 ****
int vim_free_in_input_buf(void);
int vim_used_in_input_buf(void);
char_u *get_input_buf(void);
! void set_input_buf(char_u *p);
void add_to_input_buf(char_u *s, int len);
void add_to_input_buf_csi(char_u *str, int len);
void trash_input_buf(void);
--- 19,25 ----
int vim_free_in_input_buf(void);
int vim_used_in_input_buf(void);
char_u *get_input_buf(void);
! void set_input_buf(char_u *p, int overwrite);
void add_to_input_buf(char_u *s, int len);
void add_to_input_buf_csi(char_u *str, int len);
void trash_input_buf(void);
*** ../vim-8.2.2960/src/version.c 2021-06-07 20:41:18.843857616 +0200
--- src/version.c 2021-06-07 22:02:39.230886022 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2961,
/**/
--
Mynd you, m00se bites Kan be pretty nasti ...
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202106072005.157K5Ou0656836%40masaka.moolenaar.net.