commit bash-20180914 snapshot

This commit is contained in:
Chet Ramey
2018-09-17 11:46:57 -04:00
parent b52e30b8dd
commit 9282e182d8
19 changed files with 131 additions and 25 deletions
+5 -3
View File
@@ -55,6 +55,8 @@
#define slashify_in_quotes "\\`\"$"
#define fielddelim(c) (whitespace(c) || (c) == '\n')
typedef int _hist_search_func_t PARAMS((const char *, int));
static char error_pointer;
@@ -769,7 +771,7 @@ history_expand_internal (char *string, int start, int qc, int *end_index_ptr, ch
the last time. */
if (subst_bywords && si > we)
{
for (; temp[si] && whitespace (temp[si]); si++)
for (; temp[si] && fielddelim (temp[si]); si++)
;
ws = si;
we = history_tokenize_word (temp, si);
@@ -1446,7 +1448,7 @@ history_tokenize_word (const char *string, int ind)
i = ind;
delimiter = nestdelim = 0;
if (member (string[i], "()\n"))
if (member (string[i], "()\n")) /* XXX - included \n, but why? been here forever */
{
i++;
return i;
@@ -1604,7 +1606,7 @@ history_tokenize_internal (const char *string, int wind, int *indp)
for (i = result_index = size = 0, result = (char **)NULL; string[i]; )
{
/* Skip leading whitespace. */
for (; string[i] && whitespace (string[i]); i++)
for (; string[i] && fielddelim (string[i]); i++)
;
if (string[i] == 0 || string[i] == history_comment_char)
return (result);
+26 -1
View File
@@ -51,6 +51,8 @@
extern void _hs_replace_history_data PARAMS((int, histdata_t *, histdata_t *));
extern HIST_ENTRY *_rl_saved_line_for_history;
/* Non-zero tells rl_delete_text and rl_insert_text to not add to
the undo list. */
int _rl_doing_an_undo = 0;
@@ -166,7 +168,7 @@ _rl_copy_undo_list (UNDO_LIST *head)
int
rl_do_undo (void)
{
UNDO_LIST *release;
UNDO_LIST *release, *search;
int waiting_for_begin, start, end;
HIST_ENTRY *cur, *temp;
@@ -223,6 +225,7 @@ rl_do_undo (void)
release = rl_undo_list;
rl_undo_list = rl_undo_list->next;
release->next = 0; /* XXX */
/* If we are editing a history entry, make sure the change is replicated
in the history entry's line */
@@ -235,8 +238,30 @@ rl_do_undo (void)
xfree (temp);
}
/* Make sure there aren't any history entries with that undo list */
_hs_replace_history_data (-1, (histdata_t *)release, (histdata_t *)rl_undo_list);
/* And make sure this list isn't anywhere in the saved line for history */
if (_rl_saved_line_for_history && _rl_saved_line_for_history->data)
{
/* Brute force; no finesse here */
search = (UNDO_LIST *)_rl_saved_line_for_history->data;
if (search == release)
_rl_saved_line_for_history->data = rl_undo_list;
else
{
while (search->next)
{
if (search->next == release)
{
search->next = rl_undo_list;
break;
}
search = search->next;
}
}
}
xfree (release);
}
while (waiting_for_begin);