allow quoted-insert while reading readline search strings; force filename argument to enable -f without a slash to read from the current directory; update BASH_LOADABLES_PATH documentation

This commit is contained in:
Chet Ramey
2023-11-14 10:20:05 -05:00
parent 511fef0f5c
commit f491b93350
13 changed files with 118 additions and 21 deletions
+23
View File
@@ -447,6 +447,8 @@ add_character:
cxt->lastc = -6;
else if (f == rl_bracketed_paste_begin)
cxt->lastc = -7;
else if (c == CTRL('V') || f == rl_quoted_insert)
cxt->lastc = -8;
}
/* If we changed the keymap earlier while translating a key sequence into
@@ -712,6 +714,27 @@ opcode_dispatch:
xfree (paste);
break;
case -8: /* quoted insert */
#if defined (HANDLE_SIGNALS)
if (RL_ISSTATE (RL_STATE_CALLBACK) == 0)
_rl_disable_tty_signals ();
#endif
c = _rl_search_getchar (cxt);
#if defined (HANDLE_SIGNALS)
if (RL_ISSTATE (RL_STATE_CALLBACK) == 0)
_rl_restore_tty_signals ();
#endif
if (c < 0)
{
cxt->sflags |= SF_FAILED;
cxt->history_pos = cxt->last_found_line;
return -1;
}
_rl_add_executing_keyseq (c);
/*FALLTHROUGH*/
/* Add character to search string and continue search. */
default:
#if defined (HANDLE_MULTIBYTE)
+11
View File
@@ -341,6 +341,17 @@ _rl_nsearch_dispatch (_rl_search_cxt *cxt, int c)
rl_unix_line_discard (1, c);
break;
case CTRL('Q'):
case CTRL('V'):
n = rl_quoted_insert (1, c);
if (n < 0)
{
_rl_nsearch_abort (cxt);
return -1;
}
cxt->lastc = (rl_point > 0) ? rl_line_buffer[rl_point - 1] : rl_line_buffer[0];
break;
case RETURN:
case NEWLINE:
return 0;
+12
View File
@@ -185,6 +185,12 @@ static char *_rl_term_kN;
static char *_rl_term_vs; /* very visible */
static char *_rl_term_ve; /* normal */
/* Bracketed paste */
static char *_rl_term_BE; /* enable */
static char *_rl_term_BD; /* disable */
static char *_rl_term_PS; /* paste start */
static char *_rl_term_PE; /* paste end */
/* User-settable color sequences to begin and end the active region. Defaults
are rl_term_so and rl_term_se on non-dumb terminals. */
char *_rl_active_region_start_color = NULL;
@@ -415,9 +421,13 @@ struct _tc_string {
static const struct _tc_string tc_strings[] =
{
{ "@7", &_rl_term_at7 },
{ "BD", &_rl_term_BD },
{ "BE", &_rl_term_BE },
{ "DC", &_rl_term_DC },
{ "E3", &_rl_term_clrscroll },
{ "IC", &_rl_term_IC },
{ "PE", &_rl_term_PE },
{ "PS", &_rl_term_PS },
{ "ce", &_rl_term_clreol },
{ "cl", &_rl_term_clrpag },
{ "cr", &_rl_term_cr },
@@ -497,6 +507,7 @@ _rl_init_terminal_io (const char *terminal_name)
_rl_term_kh = _rl_term_kH = _rl_term_at7 = _rl_term_kI = (char *)NULL;
_rl_term_kN = _rl_term_kP = (char *)NULL;
_rl_term_so = _rl_term_se = (char *)NULL;
_rl_term_BD = _rl_term_BE = _rl_term_PE = _rl_term_PS = (char *)NULL;
#if defined(HACK_TERMCAP_MOTION)
_rl_term_forward_char = (char *)NULL;
#endif
@@ -567,6 +578,7 @@ _rl_init_terminal_io (const char *terminal_name)
/* Assume generic unknown terminal can't handle the enable/disable
escape sequences */
_rl_term_BD = _rl_term_BE = _rl_term_PE = _rl_term_PS = (char *)NULL;
_rl_enable_bracketed_paste = 0;
/* No terminal so/se capabilities. */
+1 -1
View File
@@ -2089,7 +2089,7 @@ _rl_readstr_dispatch (_rl_readstr_cxt *cxt, int c)
_rl_readstr_restore (cxt);
return -1;
}
cxt->lastc = rl_line_buffer[rl_point - 1]; /* preserve prevc */
cxt->lastc = (rl_point > 0) ? rl_line_buffer[rl_point - 1] : rl_line_buffer[0]; /* preserve prevc */
break;
case RETURN:
+6
View File
@@ -45,3 +45,9 @@ legal_alias_name (const char *string, int flags)
{
return (valid_alias_name (string, flags));
}
int
compat_init (void)
{
return 0;
}