1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

readline: Avoid interpreting control characters in pastes.

* NEWS: Update.
* doc/ref/repl-modules.texi (Readline Options): Update for
  bracketed-paste.
* guile-readline/readline.h (SCM_READLINE_BRACKETED_PASTE): Add
  bracketed-paste option.
* guile-readline/readline.c (scm_readline_opts): Add bracketed-paste.
  (scm_init_readline): Wire up the logic.
This commit is contained in:
Andy Wingo 2017-05-17 22:09:26 +02:00
parent 7ac3d17cea
commit 96c9af4ab1
4 changed files with 27 additions and 2 deletions

17
NEWS
View file

@ -5,6 +5,23 @@ See the end for copying conditions.
Please send Guile bug reports to bug-guile@gnu.org.
Changes in 2.2.3 (since 2.2.2):
* Bug fixes
** Enable GNU Readline 7.0's support for "bracketed paste".
Before, when pasting an expression that contained TAB characters into
Guile's REPL with GNU Readline support enabled, the pasted TAB
characters would trigger autocompletion in Readline. This was never
what you wanted. Guile now sets the new "bracketed-paste" option in GNU
Readline 7.0 to on by default, making readline treat pastes into the
terminal as atomic units without control characters. See "Readline
Options" in the manual for full details.
** Fix time-monotonic from SRFI-19; broken in 2.2.1.
Changes in 2.2.2 (since 2.2.1):

View file

@ -108,6 +108,8 @@ history-file yes Use history file.
history-length 200 History length.
bounce-parens 500 Time (ms) to show matching opening parenthesis
(0 = off).
bracketed-paste yes Disable interpretation of control characters
in pastes.
@end smalllisp
The readline options interface can only be used @emph{after} loading

View file

@ -47,6 +47,8 @@ scm_t_option scm_readline_opts[] = {
"History length." },
{ SCM_OPTION_INTEGER, "bounce-parens", 500,
"Time (ms) to show matching opening parenthesis (0 = off)."},
{ SCM_OPTION_BOOLEAN, "bracketed-paste", 1,
"Disable interpretation of control characters in pastes." },
{ 0 }
};
@ -546,6 +548,9 @@ scm_init_readline ()
reentry_barrier_mutex = scm_make_mutex ();
scm_init_opts (scm_readline_options,
scm_readline_opts);
rl_variable_bind ("enable-bracketed-paste",
SCM_READLINE_BRACKETED_PASTE ? "on" : "off");
#if HAVE_RL_GET_KEYMAP
init_bouncing_parens();
#endif

View file

@ -39,7 +39,8 @@ SCM_RL_API scm_t_option scm_readline_opts[];
#define SCM_HISTORY_FILE_P scm_readline_opts[0].val
#define SCM_HISTORY_LENGTH scm_readline_opts[1].val
#define SCM_READLINE_BOUNCE_PARENS scm_readline_opts[2].val
#define SCM_N_READLINE_OPTIONS 3
#define SCM_READLINE_BRACKETED_PASTE scm_readline_opts[3].val
#define SCM_N_READLINE_OPTIONS 4
SCM_RL_API SCM scm_readline_options (SCM setting);
SCM_RL_API void scm_readline_init_ports (SCM inp, SCM outp);