commit bash-20200706 snapshot

This commit is contained in:
Chet Ramey
2020-07-07 11:08:34 -04:00
parent 51f1f17b4a
commit 9c953962b4
2 changed files with 39 additions and 10 deletions
+18 -4
View File
@@ -8653,12 +8653,26 @@ doc/{bash.1,bashref.texi}
---
lib/readline/vi_mode.c
- _rl_vi_done_inserting: make sure to close out all undo groups when
the insert performed by a `c' command finishes. Report and fix from
David Fries <David@Fries.net>
leaving insert mode, so we don't have anything dangling.
Report and fix from David Fries <David@Fries.net>
7/6
---
lib/readline/vi_mode.c
- _rl_vi_domove_motion_cleanup: the `c' and `C' commands should enter
insert mode even if the motion command doesn't delete any text. From
a report by David Fries <David@Fries.net>
insert mode even if the motion command doesn't delete any text.
From a report by David Fries <David@Fries.net>
- _rl_vi_done_inserting: add a missing rl_end_undo_group when
_rl_vi_doing_insert is set: there should be one begun by
rl_vi_start_inserting and one begun by the command (change or replace).
From a report by David Fries <David@Fries.net>
- rl_vi_replace: set _rl_vi_last_key_before_insert to 'R' explicitly,
since other code checks that and we want to allow users to rebind
this function
7/7
---
lib/readline/vi_mode.c
- rl_vi_{delete,change,yank}_to: if we have a non-null _rl_vimvcxt,
just reinitialize it so we don't have to allocate a new one. This is
a change primarily for callback mode, and fixes a memory leak
+21 -6
View File
@@ -875,8 +875,8 @@ _rl_vi_done_inserting (void)
{
if (_rl_vi_doing_insert)
{
/* The `c', `s', and `S' commands set this. */
rl_end_undo_group ();
/* The `c', `s', `S', and `R' commands set this. */
rl_end_undo_group (); /* for the group in rl_vi_start_inserting */
/* Now, the text between rl_undo_list->next->start and
rl_undo_list->next->end is what was inserted while in insert
mode. It gets copied to VI_INSERT_BUFFER because it depends
@@ -887,6 +887,9 @@ _rl_vi_done_inserting (void)
_rl_vi_save_replace (); /* Half the battle */
else
_rl_vi_save_insert (rl_undo_list->next);
/* sanity check, should always be >= 1 here */
if (_rl_undo_group_level > 0)
rl_end_undo_group (); /* for the group in the command (change or replace) */
}
else
{
@@ -900,6 +903,8 @@ _rl_vi_done_inserting (void)
rl_end_undo_group ();
}
/* Sanity check, make sure all the undo groups are closed before we leave
insert mode */
while (_rl_undo_group_level > 0)
rl_end_undo_group ();
}
@@ -1385,7 +1390,11 @@ rl_vi_delete_to (int count, int key)
{
int c, r;
_rl_vimvcxt = _rl_mvcxt_alloc (VIM_DELETE, key);
if (_rl_vimvcxt)
_rl_mvcxt_init (_rl_vimvcxt, VIM_DELETE, key);
else
_rl_vimvcxt = _rl_mvcxt_alloc (VIM_DELETE, key);
_rl_vimvcxt->start = rl_point;
rl_mark = rl_point;
@@ -1473,7 +1482,10 @@ rl_vi_change_to (int count, int key)
{
int c, r;
_rl_vimvcxt = _rl_mvcxt_alloc (VIM_CHANGE, key);
if (_rl_vimvcxt)
_rl_mvcxt_init (_rl_vimvcxt, VIM_CHANGE, key);
else
_rl_vimvcxt = _rl_mvcxt_alloc (VIM_CHANGE, key);
_rl_vimvcxt->start = rl_point;
rl_mark = rl_point;
@@ -1542,7 +1554,10 @@ rl_vi_yank_to (int count, int key)
{
int c, r;
_rl_vimvcxt = _rl_mvcxt_alloc (VIM_YANK, key);
if (_rl_vimvcxt)
_rl_mvcxt_init (_rl_vimvcxt, VIM_YANK, key);
else
_rl_vimvcxt = _rl_mvcxt_alloc (VIM_YANK, key);
_rl_vimvcxt->start = rl_point;
rl_mark = rl_point;
@@ -2250,7 +2265,7 @@ rl_vi_replace (int count, int key)
rl_vi_start_inserting (key, 1, rl_arg_sign);
_rl_vi_last_key_before_insert = key;
_rl_vi_last_key_before_insert = 'R'; /* in case someone rebinds it */
_rl_keymap = vi_replace_map;
if (_rl_enable_bracketed_paste)