commit bash-20181005 snapshot

This commit is contained in:
Chet Ramey
2018-10-08 09:19:14 -04:00
parent 5fab8dbf24
commit c87bb0a8f7
24 changed files with 235 additions and 51 deletions
+3
View File
@@ -1851,6 +1851,9 @@ If no compspec is found for the full pathname, an attempt is made to
find a compspec for the portion following the final slash.
If those searches do not result in a compspec, any compspec defined with
the @option{-D} option to @code{complete} is used as the default.
If there is no default compspec, Bash attempts alias expansion
on the command word as a final resort, and attempts to find a compspec
for the command word from any successful expansion
Once a compspec has been found, it is used to generate the list of
matching words.
+22
View File
@@ -328,6 +328,9 @@ int
_rl_isearch_dispatch (_rl_search_cxt *cxt, int c)
{
int n, wstart, wlen, limit, cval, incr;
char *paste;
size_t pastelen;
int j;
rl_command_func_t *f;
f = (rl_command_func_t *)NULL;
@@ -398,6 +401,8 @@ add_character:
cxt->lastc = -5;
else if (c == CTRL ('Y') || f == rl_yank) /* XXX */
cxt->lastc = -6;
else if (f == rl_bracketed_paste_begin)
cxt->lastc = -7;
}
/* If we changed the keymap earlier while translating a key sequence into
@@ -620,6 +625,23 @@ add_character:
cxt->search_string[cxt->search_string_index] = '\0';
break;
case -7: /* bracketed paste */
paste = _rl_bracketed_text (&pastelen);
if (paste == 0 || *paste == 0)
{
free (paste);
break;
}
if (cxt->search_string_index + pastelen + 1 >= cxt->search_string_size)
{
cxt->search_string_size += pastelen + 2;
cxt->search_string = (char *)xrealloc (cxt->search_string, cxt->search_string_size);
}
strcpy (cxt->search_string + cxt->search_string_index, paste);
cxt->search_string_index += pastelen;
free (paste);
break;
/* Add character to search string and continue search. */
default:
#if defined (HANDLE_MULTIBYTE)
+19 -5
View File
@@ -670,16 +670,16 @@ rl_yank_last_arg (int count, int key)
`bracketed paste' sequence, read the rest of the pasted input until the
closing sequence and insert the pasted text as a single unit without
interpretation. */
int
rl_bracketed_paste_begin (int count, int key)
char *
_rl_bracketed_text (size_t *lenp)
{
int retval, c;
int c;
size_t len, cap;
char *buf;
retval = 0;
len = 0;
buf = xmalloc (cap = 64);
buf[0] = '\0';
RL_SETSTATE (RL_STATE_MOREINPUT);
while ((c = rl_read_key ()) >= 0)
@@ -708,9 +708,23 @@ rl_bracketed_paste_begin (int count, int key)
if (len == cap)
buf = xrealloc (buf, cap + 1);
buf[len] = '\0';
retval = rl_insert_text (buf) == len ? 0 : 1;
}
if (lenp)
*lenp = len;
return (buf);
}
int
rl_bracketed_paste_begin (int count, int key)
{
int retval, c;
size_t len, cap;
char *buf;
buf = _rl_bracketed_text (&len);
retval = rl_insert_text (buf) == len ? 0 : 1;
xfree (buf);
return (retval);
}
+2
View File
@@ -309,6 +309,8 @@ extern int _rl_search_getchar PARAMS((_rl_search_cxt *));
#define BRACK_PASTE_INIT "\033[?2004h"
#define BRACK_PASTE_FINI "\033[?2004l\r"
extern char *_rl_bracketed_text PARAMS((size_t *));
/* macro.c */
extern void _rl_with_macro_input PARAMS((char *));
extern int _rl_peek_macro_key PARAMS((void));
+1
View File
@@ -198,6 +198,7 @@ void
rl_vi_start_inserting (int key, int repeat, int sign)
{
_rl_vi_set_last (key, repeat, sign);
rl_begin_undo_group (); /* ensure inserts aren't concatenated */
rl_vi_insertion_mode (1, key);
}