fix issue with failed history expansion changing the history list offset; fix some tests to avoid problems with error messages that differ between systems; fix issue with readline rl_abort not clearing any pending command to execute

This commit is contained in:
Chet Ramey
2024-12-30 10:45:14 -05:00
parent bb56d620e0
commit 5114e17172
18 changed files with 172 additions and 117 deletions
+4 -3
View File
@@ -141,7 +141,7 @@ get_history_event (const char *string, int *caller_index, int delimiting_quote)
register char c;
HIST_ENTRY *entry;
int which, sign, local_index, substring_okay;
int search_flags;
int search_flags, old_offset;
char *temp;
/* The event can be specified in a number of ways.
@@ -251,9 +251,10 @@ get_history_event (const char *string, int *caller_index, int delimiting_quote)
*caller_index = i;
old_offset = history_offset; /* XXX */
#define FAIL_SEARCH() \
do { \
history_offset = history_length; xfree (temp) ; return (char *)NULL; \
history_offset = old_offset; xfree (temp) ; return (char *)NULL; \
} while (0)
/* If there is no search string, try to use the previous search string,
@@ -282,7 +283,7 @@ get_history_event (const char *string, int *caller_index, int delimiting_quote)
entry = current_history ();
if (entry == 0)
FAIL_SEARCH ();
history_offset = history_length;
history_offset = old_offset; /* XXX - was history_length */
/* If this was a substring search, then remember the
string that we matched for word substitution. */
+1
View File
@@ -112,6 +112,7 @@ _rl_abort_internal (void)
RL_UNSETSTATE (RL_STATE_MULTIKEY); /* XXX */
rl_last_func = (rl_command_func_t *)NULL;
_rl_command_to_execute = 0;
_rl_longjmp (_rl_top_level, 1);
return (0);