mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-03 08:48:14 +02:00
doc changes for --rcfile; fix isearch undo list incompatibility with bash-5.2; non-inc search preserves undo lists in history entries
This commit is contained in:
+10
-3
@@ -332,7 +332,7 @@ _rl_free_history_entry (HIST_ENTRY *entry)
|
||||
|
||||
/* Perhaps put back the current line if it has changed. */
|
||||
int
|
||||
rl_maybe_replace_line (void)
|
||||
_rl_maybe_replace_line (int clear_undo)
|
||||
{
|
||||
HIST_ENTRY *temp;
|
||||
|
||||
@@ -350,12 +350,19 @@ rl_maybe_replace_line (void)
|
||||
if (_rl_saved_line_for_history && (UNDO_LIST *)_rl_saved_line_for_history->data == rl_undo_list)
|
||||
_rl_saved_line_for_history->data = 0;
|
||||
/* Do we want to set rl_undo_list = 0 here since we just saved it into
|
||||
a history entry? */
|
||||
rl_undo_list = 0;
|
||||
a history entry? We let the caller decide. */
|
||||
if (clear_undo)
|
||||
rl_undo_list = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
rl_maybe_replace_line (void)
|
||||
{
|
||||
return (_rl_maybe_replace_line (0));
|
||||
}
|
||||
|
||||
void
|
||||
_rl_unsave_line (HIST_ENTRY *entry)
|
||||
{
|
||||
|
||||
@@ -399,6 +399,7 @@ extern void _rl_free_saved_line (HIST_ENTRY *);
|
||||
extern void _rl_unsave_line (HIST_ENTRY *);
|
||||
#endif
|
||||
extern int _rl_free_saved_history_line (void);
|
||||
extern int _rl_maybe_replace_line (int);
|
||||
|
||||
extern void _rl_set_insert_mode (int, int);
|
||||
|
||||
|
||||
+10
-8
@@ -101,7 +101,7 @@ _rl_unsave_saved_search_line (void)
|
||||
from a history entry. We assume the undo list does not come from a
|
||||
history entry if we are at the end of the history, entering a new line.
|
||||
|
||||
The call to rl_maybe_replace_line() has already ensured that any undo
|
||||
The call to _rl_maybe_replace_line() has already ensured that any undo
|
||||
list pointing to a history entry has already been saved back to the
|
||||
history and set rl_undo_list to NULL. */
|
||||
|
||||
@@ -271,8 +271,9 @@ _rl_nsearch_init (int dir, int pchar)
|
||||
cxt->direction = dir;
|
||||
cxt->history_pos = cxt->save_line;
|
||||
|
||||
/* If the current line has changed, put it back into the history if necessary. */
|
||||
rl_maybe_replace_line ();
|
||||
/* If the current line has changed, put it back into the history if necessary
|
||||
and clear the undo list. */
|
||||
_rl_maybe_replace_line (1);
|
||||
|
||||
_rl_saved_line_for_search = _rl_alloc_saved_line ();
|
||||
|
||||
@@ -603,12 +604,15 @@ rl_history_search_internal (int count, int dir)
|
||||
int ret, oldpos, newcol;
|
||||
char *t;
|
||||
|
||||
/* If the current line has changed, put it back into the history if necessary. */
|
||||
rl_maybe_replace_line ();
|
||||
/* If the current line has changed, put it back into the history if necessary
|
||||
and clear the undo list. */
|
||||
_rl_maybe_replace_line (1);
|
||||
|
||||
_rl_saved_line_for_search = _rl_alloc_saved_line ();
|
||||
temp = (HIST_ENTRY *)NULL;
|
||||
|
||||
oldpos = where_history ();
|
||||
|
||||
/* Search COUNT times through the history for a line matching
|
||||
history_search_string. If history_search_string[0] == '^', the
|
||||
line must match from the start; otherwise any substring can match.
|
||||
@@ -623,10 +627,8 @@ rl_history_search_internal (int count, int dir)
|
||||
|
||||
/* Get the history entry we found. */
|
||||
_rl_history_search_pos = ret;
|
||||
oldpos = where_history ();
|
||||
history_set_pos (_rl_history_search_pos);
|
||||
temp = current_history (); /* will never be NULL after successful search */
|
||||
history_set_pos (oldpos);
|
||||
|
||||
/* Don't find multiple instances of the same line. */
|
||||
if (prev_line_found && STREQ (prev_line_found, temp->line))
|
||||
@@ -635,7 +637,7 @@ rl_history_search_internal (int count, int dir)
|
||||
count--;
|
||||
}
|
||||
|
||||
/* If we didn't find anything at all, return. */
|
||||
/* If we didn't find anything at all, return without changing history offset */
|
||||
if (temp == 0)
|
||||
{
|
||||
_rl_unsave_saved_search_line ();
|
||||
|
||||
Reference in New Issue
Block a user