mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-11 12:40:42 +02:00
readline: free undo list associated with the saved history line when traversing history
This commit is contained in:
+2
-1
@@ -934,7 +934,6 @@ rl_trim_arg_from_keyseq (const char *keyseq, size_t len, Keymap map)
|
||||
if (i + 1 == len)
|
||||
return -1;
|
||||
|
||||
map = map0;
|
||||
parsing_digits = 1;
|
||||
|
||||
/* This logic should be identical to rl_digit_loop */
|
||||
@@ -949,6 +948,8 @@ rl_trim_arg_from_keyseq (const char *keyseq, size_t len, Keymap map)
|
||||
{
|
||||
parsing_digits = 2;
|
||||
}
|
||||
|
||||
map = map0;
|
||||
j = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
+11
-2
@@ -306,8 +306,7 @@ _rl_start_using_history (void)
|
||||
{
|
||||
using_history ();
|
||||
if (_rl_saved_line_for_history)
|
||||
_rl_free_history_entry (_rl_saved_line_for_history);
|
||||
|
||||
_rl_free_saved_history_line ();
|
||||
_rl_saved_line_for_history = (HIST_ENTRY *)NULL;
|
||||
}
|
||||
|
||||
@@ -352,6 +351,8 @@ rl_maybe_unsave_line (void)
|
||||
list from a history entry, as in rl_replace_from_history() below. */
|
||||
rl_replace_line (_rl_saved_line_for_history->line, 0);
|
||||
rl_undo_list = (UNDO_LIST *)_rl_saved_line_for_history->data;
|
||||
|
||||
/* Doesn't free `data'. */
|
||||
_rl_free_history_entry (_rl_saved_line_for_history);
|
||||
_rl_saved_line_for_history = (HIST_ENTRY *)NULL;
|
||||
rl_point = rl_end; /* rl_replace_line sets rl_end */
|
||||
@@ -381,6 +382,14 @@ _rl_free_saved_history_line (void)
|
||||
{
|
||||
if (_rl_saved_line_for_history)
|
||||
{
|
||||
if (rl_undo_list && rl_undo_list == (UNDO_LIST *)_rl_saved_line_for_history->data)
|
||||
rl_undo_list = 0;
|
||||
/* Have to free this separately because _rl_free_history entry can't:
|
||||
it doesn't know whether or not this has application data. Only the
|
||||
callers that know this is _rl_saved_line_for_history can know that
|
||||
it's an undo list. */
|
||||
if (_rl_saved_line_for_history->data)
|
||||
_rl_free_undo_list ((UNDO_LIST *)_rl_saved_line_for_history->data);
|
||||
_rl_free_history_entry (_rl_saved_line_for_history);
|
||||
_rl_saved_line_for_history = (HIST_ENTRY *)NULL;
|
||||
}
|
||||
|
||||
@@ -96,8 +96,7 @@ make_history_line_current (HIST_ENTRY *entry)
|
||||
#endif
|
||||
|
||||
if (_rl_saved_line_for_history)
|
||||
_rl_free_history_entry (_rl_saved_line_for_history);
|
||||
_rl_saved_line_for_history = (HIST_ENTRY *)NULL;
|
||||
_rl_free_saved_history_line ();
|
||||
}
|
||||
|
||||
/* Search the history list for STRING starting at absolute history position
|
||||
|
||||
Reference in New Issue
Block a user