From b6e23235f28b1c85e18e9a2b7ba8c6b6c46aecbc Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Wed, 29 Jan 2014 17:00:07 -0500 Subject: bash-4.3-rc2 overlay --- lib/readline/undo.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/readline/undo.c') 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); -- cgit v1.2.1