Problem: Keys typed during a :normal command are discarded.
Solution: Concatenate saved typeahead and typed kesy. (closes #8340)
if (typeahead_saved)
{
- restore_typeahead(&typeaheadbuf);
+ restore_typeahead(&typeaheadbuf, TRUE);
ignore_script = save_ignore_script;
}
ex_normal_busy = save_ex_normal_busy;
{
--ga_userinput.ga_len;
restore_typeahead((tasave_T *)(ga_userinput.ga_data)
- + ga_userinput.ga_len);
+ + ga_userinput.ga_len, TRUE);
// default return is zero == OK
}
else if (p_verbose > 1)
restore_current_state(save_state_T *sst)
{
// Restore the previous typeahead.
- restore_typeahead(&sst->tabuf);
+ restore_typeahead(&sst->tabuf, FALSE);
msg_scroll = sst->save_msg_scroll;
restart_edit = sst->save_restart_edit;
/*
* 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)
+restore_typeahead(tasave_T *tp, int overwrite UNUSED)
{
if (tp->typebuf_valid)
{
free_buff(&readbuf2);
readbuf2 = tp->save_readbuf2;
# ifdef USE_INPUT_BUF
- set_input_buf(tp->save_inputbuf);
+ set_input_buf(tp->save_inputbuf, overwrite);
# endif
}
void del_typebuf(int len, int offset);
int save_typebuf(void);
void save_typeahead(tasave_T *tp);
-void restore_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);
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 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);
/*
* 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;
{
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);
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2961,
/**/
2960,
/**/