remove history position change to non-incremental search; fixes to $@ in some word expansions like :+

This commit is contained in:
Chet Ramey
2022-03-25 09:52:26 -04:00
parent 5bba60397c
commit 8f68f9f0ff
22 changed files with 990 additions and 976 deletions
+10 -3
View File
@@ -240,6 +240,9 @@ char *_rl_comment_begin;
/* Keymap holding the function currently being executed. */
Keymap rl_executing_keymap;
/* The function currently being executed. */
rl_command_func_t *_rl_executing_func;
/* Keymap we're currently using to dispatch. */
Keymap _rl_dispatching_keymap;
@@ -489,10 +492,10 @@ readline_internal_teardown (int eof)
/* We don't want to do this if we executed functions that call
history_set_pos to set the history offset to the line containing the
non-incremental search string. */
#if 1 /* XXX */
if (entry && rl_undo_list)
#else
#if HISTORY_SEARCH_SETS_HISTPOS
if (entry && rl_undo_list && _rl_history_search_pos != where_history ())
#else
if (entry && rl_undo_list)
#endif
{
temp = savestring (the_line);
@@ -683,6 +686,8 @@ readline_internal_charloop (void)
rl_executing_keymap = _rl_command_to_execute->map;
rl_executing_key = _rl_command_to_execute->key;
_rl_executing_func = _rl_command_to_execute->func;
rl_dispatching = 1;
RL_SETSTATE(RL_STATE_DISPATCHING);
r = (*(_rl_command_to_execute->func)) (_rl_command_to_execute->count, _rl_command_to_execute->key);
@@ -904,6 +909,8 @@ _rl_dispatch_subseq (register int key, Keymap map, int got_subseq)
rl_executing_keymap = map;
rl_executing_key = key;
_rl_executing_func = func;
RESIZE_KEYSEQ_BUFFER();
rl_executing_keyseq[rl_key_sequence_length++] = key;
rl_executing_keyseq[rl_key_sequence_length] = '\0';
+2
View File
@@ -381,6 +381,8 @@ extern void _rl_end_executing_keyseq (void);
extern void _rl_add_executing_keyseq (int);
extern void _rl_del_executing_keyseq (void);
extern rl_command_func_t *_rl_executing_func;
/* rltty.c */
extern int _rl_disable_tty_signals (void);
extern int _rl_restore_tty_signals (void);
+11
View File
@@ -517,6 +517,7 @@ static int
rl_history_search_internal (int count, int dir)
{
HIST_ENTRY *temp;
UNDO_LIST *origlist;
int ret, oldpos, newcol, had_saved_line, origpos;
char *t;
@@ -584,13 +585,23 @@ rl_history_search_internal (int count, int dir)
if (had_saved_line == 0)
_rl_free_saved_history_line ();
#if HISTORY_SEARCH_SETS_HISTPOS
/* XXX - can't make this work the way I want it to yet. Too much assumes
that rl_undo_list corresponds to the current history entry's undo list,
especially the stuff in maybe_save_line and especially maybe_replace_line.
Leaving it commented out for now. */
/* Make sure we set the current history position to the last line found so
we can do things like operate-and-get-next from here. This is similar to
how incremental search behaves. */
origlist = rl_undo_list;
rl_undo_list = 0; /* XXX - was (UNDO_LIST *)temp->data */
if (_rl_history_search_pos < origpos)
rl_get_previous_history (origpos - _rl_history_search_pos, 0);
else
rl_get_next_history (_rl_history_search_pos - origpos, 0);
rl_undo_list = origlist;
#endif
/* decide where to put rl_point -- need to change this for pattern search */
if (_rl_history_search_flags & ANCHORED_SEARCH)