diff options
author | Chet Ramey <chet.ramey@case.edu> | 2020-11-03 14:36:06 -0500 |
---|---|---|
committer | Chet Ramey <chet.ramey@case.edu> | 2020-11-03 14:36:06 -0500 |
commit | 278db80c368700ed6117fbd390c89a9b44c0240c (patch) | |
tree | fbb2773da6da4b7b8d0516731e3b6d31c4ff8c53 /lib/readline | |
parent | 5f2b5d79e0c0dd8f29e1d8e798675e33afbeda37 (diff) | |
download | bash-278db80c368700ed6117fbd390c89a9b44c0240c.tar.gz |
Bash-5.1-rc2 releasebash-5.1-rc2
Diffstat (limited to 'lib/readline')
-rw-r--r-- | lib/readline/bind.c | 4 | ||||
-rw-r--r-- | lib/readline/doc/hstech.texi | 2 | ||||
-rw-r--r-- | lib/readline/doc/rluser.texi | 2 | ||||
-rw-r--r-- | lib/readline/doc/version.texi | 6 | ||||
-rw-r--r-- | lib/readline/isearch.c | 12 | ||||
-rw-r--r-- | lib/readline/kill.c | 3 | ||||
-rw-r--r-- | lib/readline/readline.c | 3 | ||||
-rw-r--r-- | lib/readline/rlprivate.h | 5 | ||||
-rw-r--r-- | lib/readline/search.c | 2 | ||||
-rw-r--r-- | lib/readline/terminal.c | 13 |
10 files changed, 38 insertions, 14 deletions
diff --git a/lib/readline/bind.c b/lib/readline/bind.c index 3cbed2cc..87596dce 100644 --- a/lib/readline/bind.c +++ b/lib/readline/bind.c @@ -1812,7 +1812,7 @@ static const struct { { "convert-meta", &_rl_convert_meta_chars_to_ascii, 0 }, { "disable-completion", &rl_inhibit_completion, 0 }, { "echo-control-characters", &_rl_echo_control_chars, 0 }, - { "enable-bracketed-paste", &_rl_enable_bracketed_paste, 0 }, + { "enable-bracketed-paste", &_rl_enable_bracketed_paste, V_SPECIAL }, { "enable-keypad", &_rl_enable_keypad, 0 }, { "enable-meta-key", &_rl_enable_meta, 0 }, { "expand-tilde", &rl_complete_with_tilde_expansion, 0 }, @@ -1878,6 +1878,8 @@ hack_special_boolean_var (int i) } else if (_rl_stricmp (name, "show-mode-in-prompt") == 0) _rl_reset_prompt (); + else if (_rl_stricmp (name, "enable-bracketed-paste") == 0) + _rl_enable_active_region = _rl_enable_bracketed_paste; } typedef int _rl_sv_func_t PARAMS((const char *)); diff --git a/lib/readline/doc/hstech.texi b/lib/readline/doc/hstech.texi index 2de62f76..7ac11953 100644 --- a/lib/readline/doc/hstech.texi +++ b/lib/readline/doc/hstech.texi @@ -1,7 +1,7 @@ @ignore This file documents the user interface to the GNU History library. -Copyright (C) 1988-2016 Free Software Foundation, Inc. +Copyright (C) 1988-2020 Free Software Foundation, Inc. Authored by Brian Fox and Chet Ramey. Permission is granted to make and distribute verbatim copies of this manual diff --git a/lib/readline/doc/rluser.texi b/lib/readline/doc/rluser.texi index 746e38c8..26b0ff07 100644 --- a/lib/readline/doc/rluser.texi +++ b/lib/readline/doc/rluser.texi @@ -546,7 +546,7 @@ When set to @samp{On}, Readline will configure the terminal in a way that will enable it to insert each paste into the editing buffer as a single string of characters, instead of treating each character as if it had been read from the keyboard. This can prevent pasted characters -from being interpreted as editing commands. The default is @samp{off}. +from being interpreted as editing commands. The default is @samp{On}. @item enable-keypad @vindex enable-keypad diff --git a/lib/readline/doc/version.texi b/lib/readline/doc/version.texi index cb495abf..abb9cb6b 100644 --- a/lib/readline/doc/version.texi +++ b/lib/readline/doc/version.texi @@ -4,7 +4,7 @@ Copyright (C) 1988-2020 Free Software Foundation, Inc. @set EDITION 8.1 @set VERSION 8.1 -@set UPDATED 17 July 2020 -@set UPDATED-MONTH July 2020 +@set UPDATED 29 October 2020 +@set UPDATED-MONTH October 2020 -@set LASTCHANGE Fri Jul 17 09:35:36 EDT 2020 +@set LASTCHANGE Thu Oct 29 16:49:01 EDT 2020 diff --git a/lib/readline/isearch.c b/lib/readline/isearch.c index 201a37bb..ef65e5f5 100644 --- a/lib/readline/isearch.c +++ b/lib/readline/isearch.c @@ -357,7 +357,7 @@ _rl_isearch_dispatch (_rl_search_cxt *cxt, int c) /* XXX - experimental code to allow users to bracketed-paste into the search string even when ESC is one of the isearch-terminators. Not perfect yet. */ - if (_rl_enable_bracketed_paste && c == ESC && strchr (cxt->search_terminators, c) && (n = _rl_nchars_available ()) > (2*BRACK_PASTE_SLEN-1)) + if (_rl_enable_bracketed_paste && c == ESC && strchr (cxt->search_terminators, c) && (n = _rl_nchars_available ()) > (BRACK_PASTE_SLEN-1)) { j = _rl_read_bracketed_paste_prefix (c); if (j == 1) @@ -418,9 +418,11 @@ add_character: { /* If we have a multibyte character, see if it's bound to something that affects the search. */ - if (cxt->mb[1]) +#if defined (HANDLE_MULTIBYTE) + if (MB_CUR_MAX > 1 && rl_byte_oriented == 0 && cxt->mb[1]) f = rl_function_of_keyseq (cxt->mb, cxt->keymap, (int *)NULL); else +#endif { f = cxt->keymap[c].function; if (f == rl_do_lowercase_version) @@ -680,7 +682,8 @@ opcode_dispatch: free (paste); break; } - rl_activate_mark (); + if (_rl_enable_active_region) + rl_activate_mark (); if (cxt->search_string_index + pastelen + 1 >= cxt->search_string_size) { cxt->search_string_size += pastelen + 2; @@ -805,7 +808,8 @@ opcode_dispatch: { cxt->prev_line_found = cxt->lines[cxt->history_pos]; rl_replace_line (cxt->lines[cxt->history_pos], 0); - rl_activate_mark (); + if (_rl_enable_active_region) + rl_activate_mark (); rl_point = cxt->sline_index; if (rl_mark_active_p () && cxt->search_string_index > 0) rl_mark = rl_point + cxt->search_string_index; diff --git a/lib/readline/kill.c b/lib/readline/kill.c index e9d52502..50c3fdea 100644 --- a/lib/readline/kill.c +++ b/lib/readline/kill.c @@ -729,7 +729,8 @@ rl_bracketed_paste_begin (int count, int key) buf = _rl_bracketed_text (&len); rl_mark = rl_point; retval = rl_insert_text (buf) == len ? 0 : 1; - rl_activate_mark (); + if (_rl_enable_active_region) + rl_activate_mark (); xfree (buf); return (retval); diff --git a/lib/readline/readline.c b/lib/readline/readline.c index 800eb119..e61d188b 100644 --- a/lib/readline/readline.c +++ b/lib/readline/readline.c @@ -321,7 +321,8 @@ int _rl_show_mode_in_prompt = 0; /* Non-zero means to attempt to put the terminal in `bracketed paste mode', where it will prefix pasted text with an escape sequence and send another to mark the end of the paste. */ -int _rl_enable_bracketed_paste = 1; /* XXX - for now */ +int _rl_enable_bracketed_paste = BRACKETED_PASTE_DEFAULT; +int _rl_enable_active_region = BRACKETED_PASTE_DEFAULT; /* **************************************************************** */ /* */ diff --git a/lib/readline/rlprivate.h b/lib/readline/rlprivate.h index 050f5068..23ab2d8c 100644 --- a/lib/readline/rlprivate.h +++ b/lib/readline/rlprivate.h @@ -312,6 +312,10 @@ extern int _rl_isearch_cleanup PARAMS((_rl_search_cxt *, int)); extern int _rl_search_getchar PARAMS((_rl_search_cxt *)); /* kill.c */ +#ifndef BRACKETED_PASTE_DEFAULT +# define BRACKETED_PASTE_DEFAULT 1 /* XXX - for now */ +#endif + #define BRACK_PASTE_PREF "\033[200~" #define BRACK_PASTE_SUFF "\033[201~" @@ -532,6 +536,7 @@ extern int _rl_revert_all_at_newline; extern int _rl_echo_control_chars; extern int _rl_show_mode_in_prompt; extern int _rl_enable_bracketed_paste; +extern int _rl_enable_active_region; extern char *_rl_comment_begin; extern unsigned char _rl_parsing_conditionalized_out; extern Keymap _rl_keymap; diff --git a/lib/readline/search.c b/lib/readline/search.c index ab65a375..38a29361 100644 --- a/lib/readline/search.c +++ b/lib/readline/search.c @@ -192,7 +192,7 @@ noninc_dosearch (char *string, int dir, int flags) make_history_line_current (entry); - if (_rl_enable_bracketed_paste && ((flags & SF_PATTERN) == 0) && ind > 0 && ind < rl_end) + if (_rl_enable_active_region && ((flags & SF_PATTERN) == 0) && ind > 0 && ind < rl_end) { rl_point = ind; rl_mark = ind + strlen (string); diff --git a/lib/readline/terminal.c b/lib/readline/terminal.c index 41b6f194..05415dc4 100644 --- a/lib/readline/terminal.c +++ b/lib/readline/terminal.c @@ -456,7 +456,7 @@ _rl_init_terminal_io (const char *terminal_name) { const char *term; char *buffer; - int tty, tgetent_ret; + int tty, tgetent_ret, dumbterm; term = terminal_name ? terminal_name : sh_get_env_value ("TERM"); _rl_term_clrpag = _rl_term_cr = _rl_term_clreol = _rl_term_clrscroll = (char *)NULL; @@ -465,6 +465,8 @@ _rl_init_terminal_io (const char *terminal_name) if (term == 0) term = "dumb"; + dumbterm = STREQ (term, "dumb"); + #ifdef __MSDOS__ _rl_term_im = _rl_term_ei = _rl_term_ic = _rl_term_IC = (char *)NULL; _rl_term_up = _rl_term_dc = _rl_term_DC = _rl_visible_bell = (char *)NULL; @@ -544,6 +546,10 @@ _rl_init_terminal_io (const char *terminal_name) _rl_term_so = _rl_term_se = (char *)NULL; _rl_terminal_can_insert = term_has_meta = 0; + /* Assume generic unknown terminal can't handle the enable/disable + escape sequences */ + _rl_enable_bracketed_paste = 0; + /* Reasonable defaults for tgoto(). Readline currently only uses tgoto if _rl_term_IC or _rl_term_DC is defined, but just in case we change that later... */ @@ -595,6 +601,11 @@ _rl_init_terminal_io (const char *terminal_name) bind_termcap_arrow_keys (vi_insertion_keymap); #endif /* VI_MODE */ + /* There's no way to determine whether or not a given terminal supports + bracketed paste mode, so we assume a terminal named "dumb" does not. */ + if (dumbterm) + _rl_enable_bracketed_paste = 0; + return 0; } |