summaryrefslogtreecommitdiff
path: root/lib/readline/undo.c
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2014-01-29 17:00:07 -0500
committerChet Ramey <chet.ramey@case.edu>2014-01-29 17:00:07 -0500
commitb6e23235f28b1c85e18e9a2b7ba8c6b6c46aecbc (patch)
tree00fdd9c37c261d89c994fc1856252df719afec3a /lib/readline/undo.c
parent8581f42df9a1b1d848e2d4bdf3cc951b8d14b5be (diff)
downloadbash-4.3-testing.tar.gz
bash-4.3-rc2 overlaybash-4.3-rc2bash-4.3-testing
Diffstat (limited to 'lib/readline/undo.c')
-rw-r--r--lib/readline/undo.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/readline/undo.c b/lib/readline/undo.c
index 32873d27..a3d40447 100644
--- a/lib/readline/undo.c
+++ b/lib/readline/undo.c
@@ -178,6 +178,7 @@ rl_do_undo ()
{
UNDO_LIST *release;
int waiting_for_begin, start, end;
+ HIST_ENTRY *cur, *temp;
#define TRANS(i) ((i) == -1 ? rl_point : ((i) == -2 ? rl_end : (i)))
@@ -232,6 +233,18 @@ rl_do_undo ()
release = rl_undo_list;
rl_undo_list = rl_undo_list->next;
+
+ /* If we are editing a history entry, make sure the change is replicated
+ in the history entry's line */
+ cur = current_history ();
+ if ((UNDO_LIST *)cur->data == release)
+ {
+ temp = replace_history_entry (where_history (), rl_line_buffer, (histdata_t)rl_undo_list);
+ xfree (temp->line);
+ FREE (temp->timestamp);
+ xfree (temp);
+ }
+
replace_history_data (-1, (histdata_t *)release, (histdata_t *)rl_undo_list);
xfree (release);