From bf09dfc08dce0c7691083cf7e1d115464e6adafd Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Fri, 11 Feb 2022 09:12:39 -0500 Subject: [PATCH] document new readline variables "active-region-start-color" and "active-region-end-color" --- CWRU/CWRU.chlog | 32 +++++++++++- MANIFEST | 1 + doc/bash.1 | 30 +++++++++++- examples/loadables/perl/bperl.c | 17 +++++-- examples/loadables/perl/iperl.c | 16 +++++- lib/readline/bind.c | 28 ++--------- lib/readline/display.c | 16 ++---- lib/readline/doc/history.texi | 2 +- lib/readline/doc/hstech.texi | 2 +- lib/readline/doc/hsuser.texi | 2 +- lib/readline/doc/readline.3 | 30 +++++++++++- lib/readline/doc/rlman.texi | 2 +- lib/readline/doc/rltech.texi | 2 +- lib/readline/doc/rluser.texi | 30 +++++++++++- lib/readline/doc/rluserman.texi | 2 +- lib/readline/doc/version.texi | 13 ++--- lib/readline/readline.c | 3 -- lib/readline/rlprivate.h | 5 +- lib/readline/terminal.c | 87 +++++++++++++++++++++++++++++++-- tests/nquote.right | 10 ++++ tests/nquote.tests | 1 + tests/nquote5.sub | 22 +++++++++ 22 files changed, 283 insertions(+), 70 deletions(-) create mode 100644 tests/nquote5.sub diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 859135ee..ff9f2a5c 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -3124,7 +3124,7 @@ lib/readline/display.c - putc_face: if setting standout mode, check for both the start color and end color variables and output the start color string. If turning off standout mode (normal face), output the end color string. Both - varibables must be set + variables must be set lib/readline/{readline.c,rlprivate.h} - declarations for _rl_active_region_start_color and @@ -3139,3 +3139,33 @@ shell.c - subshell_exit: make sure to set last_command_exit_value before calling the exit trap. Fixes bug reported by Greg Edwards + + 2/9 + --- +lib/readline/{terminal.c,rlprivate.h} + - _rl_region_color_on,_rl_region_color_off: functions to output the + _rl_active_region_start_color and _rl_active_region_end_color + - _rl_reset_region_color: function to encapsulate setting the region + color to an arbitrary string, including doing memory management + +lib/readline/display.c + - putc_face: call _rl_region_color_on and _rl_region_color_off instead + of _rl_standout_on and _rl_standout_off + +lib/readline/terminal.c + - _rl_init_terminal_io: initialize _rl_active_region_start_color and + _rl_active_region_end_color from _rl_term_so and _rl_term_se, + respectively; reset every time the terminal is changed + - _rl_init_terminal_io: turn off the active region for a dumb terminal + +lib/readline/bind.c + - sv_region_{start,end}_color: call _rl_reset_region_color with the + appropriate value for WHICH + + 2/10 + ---- +lib/readline/doc/{rluser.texi,readline.3},doc/bash.1 + - active-region-start-color,active-region-end-color: documented new + bindable readline variables + - enable-active-region: document using active-region-start-color to + highlight the text in the region diff --git a/MANIFEST b/MANIFEST index a4cd9ead..eba2c267 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1274,6 +1274,7 @@ tests/nquote1.sub f tests/nquote2.sub f tests/nquote3.sub f tests/nquote4.sub f +tests/nquote5.sub f tests/nquote1.tests f tests/nquote1.right f tests/nquote2.tests f diff --git a/doc/bash.1 b/doc/bash.1 index 7056ec29..cab70036 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -5,12 +5,12 @@ .\" Case Western Reserve University .\" chet.ramey@case.edu .\" -.\" Last Change: Sat Feb 5 18:20:32 EST 2022 +.\" Last Change: Thu Feb 10 11:04:52 EST 2022 .\" .\" bash_builtins, strip all but Built-Ins section .if \n(zZ=1 .ig zZ .if \n(zY=1 .ig zY -.TH BASH 1 "2022 February 5" "GNU Bash 5.2" +.TH BASH 1 "2022 February 10" "GNU Bash 5.2" .\" .\" There's some problem with having a `@' .\" in a tagged paragraph with the BSD man macros. @@ -5918,6 +5918,30 @@ The variables and their default values are: .PP .PD 0 .TP +.B active-region-start-color +A string variable that controls the text color and background when displaying +the text in the active region (see the description of +\fBenable\-active\-region\fP below). +This string must not take up any physical character positions on the display, +so it should consist only of terminal escape sequences. +It is output to the terminal before displaying the text in the active region. +This variable is reset to the default value whenever the terminal type changes. +The default value is the string that puts the terminal in standout mode, +as obtained from the terminal's terminfo description. +A sample value might be \f(CW\ee[01;33m\fP. +.TP +.B active-region-end-color +A string variable that "undoes" the effects of \fBactive-region-start-color\fP +and restores "normal" terminal display appearance after displaying text +in the active region. +This string must not take up any physical character positions on the display, +so it should consist only of terminal escape sequences. +It is output to the terminal after displaying the text in the active region. +This variable is reset to the default value whenever the terminal type changes. +The default value is the string that restores the terminal from standout mode, +as obtained from the terminal's terminfo description. +A sample value might be \f(CW\ee[0m\fP. +.TP .B bell\-style (audible) Controls what happens when readline wants to ring the terminal bell. If set to \fBnone\fP, readline never rings the bell. If set to @@ -6037,6 +6061,8 @@ The text between the point and mark is referred to as the \fIregion\fP. When this variable is set to \fIOn\fP, readline allows certain commands to designate the region as \fIactive\fP. When the region is active, readline highlights the text in the region using +the value of the \fBactive\-region\-start\-color\fP, which defaults to the +string that enables the terminal's standout mode. The active region shows the text inserted by bracketed-paste and any matching text found by incremental and non-incremental history searches. diff --git a/examples/loadables/perl/bperl.c b/examples/loadables/perl/bperl.c index 77e3f7c1..5b15258b 100644 --- a/examples/loadables/perl/bperl.c +++ b/examples/loadables/perl/bperl.c @@ -3,23 +3,24 @@ */ #include -#include #include #include "builtins.h" #include "shell.h" +#include "common.h" #ifndef errno extern int errno; #endif -extern char **make_builtin_argv (); +extern char **make_builtin_argv (WORD_LIST *, int *); extern char **export_env; -extern int perl_main(); +extern void perl_close(void); +extern int perl_main(int, char **, char **); -bperl_builtin(list) -WORD_LIST *list; +int +bperl_builtin(WORD_LIST *list) { char **v; int c, r; @@ -31,6 +32,12 @@ WORD_LIST *list; return r; } +void +bperl_builtin_unload (char *s) +{ + perl_close(); +} + char *bperl_doc[] = { "An interface to a perl5 interpreter.", (char *)0 diff --git a/examples/loadables/perl/iperl.c b/examples/loadables/perl/iperl.c index 92a60387..89438af1 100644 --- a/examples/loadables/perl/iperl.c +++ b/examples/loadables/perl/iperl.c @@ -1,15 +1,29 @@ #include /* from the Perl distribution */ #include /* from the Perl distribution */ -extern void xs_init _((void)); +#define iperl my_perl /* I guess the name `my_perl' is required */ + +extern void xs_init (pTHX); static PerlInterpreter *iperl; /*** The Perl interpreter ***/ +static int first = 1; + +void +perl_close (void) +{ + PERL_SYS_TERM(); +} + int perl_main(int argc, char **argv, char **env) { int r; + if (first) { + first = 0; + PERL_SYS_INIT3(&argc, &argv, &env); + } iperl = perl_alloc(); perl_construct(iperl); perl_parse(iperl, xs_init, argc, argv, (char **)NULL); diff --git a/lib/readline/bind.c b/lib/readline/bind.c index aa69dce3..971116a9 100644 --- a/lib/readline/bind.c +++ b/lib/readline/bind.c @@ -1,6 +1,6 @@ /* bind.c -- key binding and startup file support for the readline library. */ -/* Copyright (C) 1987-2021 Free Software Foundation, Inc. +/* Copyright (C) 1987-2022 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -2227,35 +2227,13 @@ sv_seqtimeout (const char *value) static int sv_region_start_color (const char *value) { - int len; - - free (_rl_active_region_start_color); - if (value && *value) - { - _rl_active_region_start_color = (char *)xmalloc (2 * strlen (value) + 1); - rl_translate_keyseq (value, _rl_active_region_start_color, &len); - _rl_active_region_start_color[len] = '\0'; - } - else - _rl_active_region_start_color = NULL; - return 0; + return (_rl_reset_region_color (0, value)); } static int sv_region_end_color (const char *value) { - int len; - - free (_rl_active_region_end_color); - if (value && *value) - { - _rl_active_region_end_color = (char *)xmalloc (2 * strlen (value) + 1); - rl_translate_keyseq (value, _rl_active_region_end_color, &len); - _rl_active_region_end_color[len] = '\0'; - } - else - _rl_active_region_end_color = NULL; - return 0; + return (_rl_reset_region_color (1, value)); } static int diff --git a/lib/readline/display.c b/lib/readline/display.c index e68673ad..fe1e4cc9 100644 --- a/lib/readline/display.c +++ b/lib/readline/display.c @@ -1,6 +1,6 @@ /* display.c -- readline redisplay facility. */ -/* Copyright (C) 1987-2021 Free Software Foundation, Inc. +/* Copyright (C) 1987-2022 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -1595,19 +1595,9 @@ putc_face (int c, int face, char *cur_face) if (face != FACE_NORMAL && face != FACE_STANDOUT) return; if (face == FACE_STANDOUT && cf == FACE_NORMAL) - { - if (_rl_active_region_start_color && _rl_active_region_end_color) - tputs (_rl_active_region_start_color, 1, _rl_output_character_function); - else - _rl_standout_on (); - } + _rl_region_color_on (); if (face == FACE_NORMAL && cf == FACE_STANDOUT) - { - if (_rl_active_region_start_color && _rl_active_region_end_color) - tputs (_rl_active_region_end_color, 1, _rl_output_character_function); - else - _rl_standout_off (); - } + _rl_region_color_off (); *cur_face = face; } if (c != EOF) diff --git a/lib/readline/doc/history.texi b/lib/readline/doc/history.texi index 7a3a4767..721118bc 100644 --- a/lib/readline/doc/history.texi +++ b/lib/readline/doc/history.texi @@ -12,7 +12,7 @@ This document describes the GNU History library a programming tool that provides a consistent user interface for recalling lines of previously typed input. -Copyright @copyright{} 1988--2020 Free Software Foundation, Inc. +Copyright @copyright{} 1988--2022 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document diff --git a/lib/readline/doc/hstech.texi b/lib/readline/doc/hstech.texi index 7ac11953..da6417b4 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-2020 Free Software Foundation, Inc. +Copyright (C) 1988-2022 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/hsuser.texi b/lib/readline/doc/hsuser.texi index 0a81c46e..99351e32 100644 --- a/lib/readline/doc/hsuser.texi +++ b/lib/readline/doc/hsuser.texi @@ -1,7 +1,7 @@ @ignore This file documents the user interface to the GNU History library. -Copyright (C) 1988--2020 Free Software Foundation, Inc. +Copyright (C) 1988--2022 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/readline.3 b/lib/readline/doc/readline.3 index 92ee63d1..e3f6e850 100644 --- a/lib/readline/doc/readline.3 +++ b/lib/readline/doc/readline.3 @@ -6,9 +6,9 @@ .\" Case Western Reserve University .\" chet.ramey@case.edu .\" -.\" Last Change: Mon Nov 15 17:06:54 EST 2021 +.\" Last Change: Thu Feb 10 10:58:32 EST 2022 .\" -.TH READLINE 3 "2021 November 15" "GNU Readline 8.1" +.TH READLINE 3 "2022 February 10" "GNU Readline 8.2" .\" .\" File Name macro. This used to be `.PN', for Path Name, .\" but Sun doesn't seem to like that very much. @@ -339,6 +339,30 @@ The variables and their default values are: .PP .PD 0 .TP +.B active-region-start-color +A string variable that controls the text color and background when displaying +the text in the active region (see the description of +\fBenable\-active\-region\fP below). +This string must not take up any physical character positions on the display, +so it should consist only of terminal escape sequences. +It is output to the terminal before displaying the text in the active region. +This variable is reset to the default value whenever the terminal type changes. +The default value is the string that puts the terminal in standout mode, +as obtained from the terminal's terminfo description. +A sample value might be \f(CW\ee[01;33m\fP. +.TP +.B active-region-end-color +A string variable that "undoes" the effects of \fBactive-region-start-color\fP +and restores "normal" terminal display appearance after displaying text +in the active region. +This string must not take up any physical character positions on the display, +so it should consist only of terminal escape sequences. +It is output to the terminal after displaying the text in the active region. +This variable is reset to the default value whenever the terminal type changes. +The default value is the string that restores the terminal from standout mode, +as obtained from the terminal's terminfo description. +A sample value might be \f(CW\ee[0m\fP. +.TP .B bell\-style (audible) Controls what happens when readline wants to ring the terminal bell. If set to \fBnone\fP, readline never rings the bell. If set to @@ -458,6 +482,8 @@ The text between the point and mark is referred to as the \fIregion\fP. When this variable is set to \fIOn\fP, readline allows certain commands to designate the region as \fIactive\fP. When the region is active, readline highlights the text in the region using +the value of the \fBactive\-region\-start\-color\fP, which defaults to the +string that enables the terminal's standout mode. The active region shows the text inserted by bracketed-paste and any matching text found by incremental and non-incremental history searches. diff --git a/lib/readline/doc/rlman.texi b/lib/readline/doc/rlman.texi index ec7487b7..d046b87d 100644 --- a/lib/readline/doc/rlman.texi +++ b/lib/readline/doc/rlman.texi @@ -13,7 +13,7 @@ This manual describes the GNU Readline Library consistency of user interface across discrete programs which provide a command line interface. -Copyright @copyright{} 1988--2020 Free Software Foundation, Inc. +Copyright @copyright{} 1988--2022 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document diff --git a/lib/readline/doc/rltech.texi b/lib/readline/doc/rltech.texi index a1eac5eb..01343edc 100644 --- a/lib/readline/doc/rltech.texi +++ b/lib/readline/doc/rltech.texi @@ -7,7 +7,7 @@ This document describes the GNU Readline Library, a utility for aiding in the consistency of user interface across discrete programs that need to provide a command line interface. -Copyright (C) 1988--2020 Free Software Foundation, Inc. +Copyright (C) 1988--2022 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice diff --git a/lib/readline/doc/rluser.texi b/lib/readline/doc/rluser.texi index 505225b9..63e2c75d 100644 --- a/lib/readline/doc/rluser.texi +++ b/lib/readline/doc/rluser.texi @@ -9,7 +9,7 @@ use these features. There is a document entitled "readline.texinfo" which contains both end-user and programmer documentation for the GNU Readline Library. -Copyright (C) 1988--2020 Free Software Foundation, Inc. +Copyright (C) 1988--2022 Free Software Foundation, Inc. Authored by Brian Fox and Chet Ramey. @@ -419,6 +419,32 @@ variables. @cindex variables, readline @table @code +@item active-region-start-color +@vindex active-region-start-color +A string variable that controls the text color and background when displaying +the text in the active region (see the description of +@code{enable-active-region} below). +This string must not take up any physical character positions on the display, +so it should consist only of terminal escape sequences. +It is output to the terminal before displaying the text in the active region. +This variable is reset to the default value whenever the terminal type changes. +The default value is the string that puts the terminal in standout mode, +as obtained from the terminal's terminfo description. +A sample value might be @samp{\e[01;33m}. + +@item active-region-end-color +@vindex active-region-end-color +A string variable that "undoes" the effects of @code{active-region-start-color} +and restores "normal" terminal display appearance after displaying text +in the active region. +This string must not take up any physical character positions on the display, +so it should consist only of terminal escape sequences. +It is output to the terminal after displaying the text in the active region. +This variable is reset to the default value whenever the terminal type changes. +The default value is the string that restores the terminal from standout mode, +as obtained from the terminal's terminfo description. +A sample value might be @samp{\e[0m}. + @item bell-style @vindex bell-style Controls what happens when Readline wants to ring the terminal bell. @@ -553,6 +579,8 @@ The text between the point and mark is referred to as the @dfn{region}. When this variable is set to @samp{On}, Readline allows certain commands to designate the region as @dfn{active}. When the region is active, Readline highlights the text in the region using +the value of the @code{active-region-start-color}, which defaults to the +string that enables the terminal's standout mode. The active region shows the text inserted by bracketed-paste and any matching text found by incremental and non-incremental history searches. diff --git a/lib/readline/doc/rluserman.texi b/lib/readline/doc/rluserman.texi index 6e8e848b..ae9ec6eb 100644 --- a/lib/readline/doc/rluserman.texi +++ b/lib/readline/doc/rluserman.texi @@ -12,7 +12,7 @@ This manual describes the end user interface of the GNU Readline Library consistency of user interface across discrete programs which provide a command line interface. -Copyright @copyright{} 1988--2020 Free Software Foundation, Inc. +Copyright @copyright{} 1988--2022 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document diff --git a/lib/readline/doc/version.texi b/lib/readline/doc/version.texi index 0d5883fb..46c88bdb 100644 --- a/lib/readline/doc/version.texi +++ b/lib/readline/doc/version.texi @@ -1,10 +1,11 @@ @ignore -Copyright (C) 1988-2021 Free Software Foundation, Inc. +Copyright (C) 1988-2022 Free Software Foundation, Inc. @end ignore -@set EDITION 8.1 -@set VERSION 8.1 -@set UPDATED 15 November 2021 -@set UPDATED-MONTH November 2021 +@set EDITION 8.2 +@set VERSION 8.2 -@set LASTCHANGE Mon Nov 15 17:05:28 EST 2021 +@set UPDATED Thu Feb 10 10:56:04 EST 2022 +@set UPDATED-MONTH February 2022 + +@set LASTCHANGE Thu Feb 10 10:56:20 EST 2022 diff --git a/lib/readline/readline.c b/lib/readline/readline.c index c597edb7..371e1fbc 100644 --- a/lib/readline/readline.c +++ b/lib/readline/readline.c @@ -323,9 +323,6 @@ int _rl_show_mode_in_prompt = 0; int _rl_enable_bracketed_paste = BRACKETED_PASTE_DEFAULT; int _rl_enable_active_region = BRACKETED_PASTE_DEFAULT; -char *_rl_active_region_start_color = NULL; -char *_rl_active_region_end_color = NULL; - /* **************************************************************** */ /* */ /* Top Level Functions */ diff --git a/lib/readline/rlprivate.h b/lib/readline/rlprivate.h index 3b4cba44..db20b92c 100644 --- a/lib/readline/rlprivate.h +++ b/lib/readline/rlprivate.h @@ -1,7 +1,7 @@ /* rlprivate.h -- functions and variables global to the readline library, but not intended for use by applications. */ -/* Copyright (C) 1999-2021 Free Software Foundation, Inc. +/* Copyright (C) 1999-2022 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -415,6 +415,9 @@ extern void _rl_control_keypad (int); extern void _rl_set_cursor (int, int); extern void _rl_standout_on (void); extern void _rl_standout_off (void); +extern int _rl_reset_region_color (int, const char *); +extern void _rl_region_color_on (void); +extern void _rl_region_color_off (void); /* text.c */ extern void _rl_fix_point (int); diff --git a/lib/readline/terminal.c b/lib/readline/terminal.c index 5b4ef1bd..bddf1ed4 100644 --- a/lib/readline/terminal.c +++ b/lib/readline/terminal.c @@ -1,6 +1,6 @@ /* terminal.c -- controlling the terminal with termcap. */ -/* Copyright (C) 1996-2021 Free Software Foundation, Inc. +/* Copyright (C) 1996-2022 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -185,6 +185,11 @@ static char *_rl_term_kN; static char *_rl_term_vs; /* very visible */ static char *_rl_term_ve; /* normal */ +/* 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; +char *_rl_active_region_end_color = NULL; + /* It's not clear how HPUX is so broken here. */ #ifdef TGETENT_BROKEN # define TGETENT_SUCCESS 0 @@ -466,7 +471,7 @@ _rl_init_terminal_io (const char *terminal_name) { const char *term; char *buffer; - int tty, tgetent_ret, dumbterm; + int tty, tgetent_ret, dumbterm, reset_region_colors; term = terminal_name ? terminal_name : sh_get_env_value ("TERM"); _rl_term_clrpag = _rl_term_cr = _rl_term_clreol = _rl_term_clrscroll = (char *)NULL; @@ -477,6 +482,8 @@ _rl_init_terminal_io (const char *terminal_name) dumbterm = STREQ (term, "dumb"); + reset_region_colors = 1; + #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; @@ -562,6 +569,11 @@ _rl_init_terminal_io (const char *terminal_name) escape sequences */ _rl_enable_bracketed_paste = 0; + /* No terminal so/se capabilities. */ + _rl_enable_active_region = 0; + _rl_reset_region_color (0, NULL); + _rl_reset_region_color (1, NULL); + /* 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... */ @@ -616,8 +628,14 @@ _rl_init_terminal_io (const char *terminal_name) /* 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; - + _rl_enable_bracketed_paste = _rl_enable_active_region = 0; + + if (reset_region_colors) + { + _rl_reset_region_color (0, _rl_term_so); + _rl_reset_region_color (1, _rl_term_se); + } + return 0; } @@ -789,6 +807,67 @@ _rl_standout_off (void) #endif } +/* **************************************************************** */ +/* */ +/* Controlling color for a portion of the line */ +/* */ +/* **************************************************************** */ + +/* Reset the region color variables to VALUE depending on WHICH (0 == start, + 1 == end). This is where all the memory allocation for the color variable + strings is performed. We might want to pass a flag saying whether or not + to translate VALUE like a key sequence, but it doesn't really matter. */ +int +_rl_reset_region_color (int which, const char *value) +{ + int len; + + if (which == 0) + { + free (_rl_active_region_start_color); + if (value && *value) + { + _rl_active_region_start_color = (char *)xmalloc (2 * strlen (value) + 1); + rl_translate_keyseq (value, _rl_active_region_start_color, &len); + _rl_active_region_start_color[len] = '\0'; + } + else + _rl_active_region_start_color = NULL; + } + else + { + free (_rl_active_region_end_color); + if (value && *value) + { + _rl_active_region_end_color = (char *)xmalloc (2 * strlen (value) + 1); + rl_translate_keyseq (value, _rl_active_region_end_color, &len); + _rl_active_region_end_color[len] = '\0'; + } + else + _rl_active_region_end_color = NULL; + } + + return 0; +} + +void +_rl_region_color_on (void) +{ +#ifndef __MSDOS__ + if (_rl_active_region_start_color && _rl_active_region_end_color) + tputs (_rl_active_region_start_color, 1, _rl_output_character_function); +#endif +} + +void +_rl_region_color_off (void) +{ +#ifndef __MSDOS__ + if (_rl_active_region_start_color && _rl_active_region_end_color) + tputs (_rl_active_region_end_color, 1, _rl_output_character_function); +#endif +} + /* **************************************************************** */ /* */ /* Controlling the Meta Key and Keypad */ diff --git a/tests/nquote.right b/tests/nquote.right index 5c9a5166..918aa429 100644 --- a/tests/nquote.right +++ b/tests/nquote.right @@ -68,3 +68,13 @@ argv[1] = <^?> \q foo ./nquote4.sub: line 6: quux: command not found +argv[1] = +argv[1] = +argv[1] = <^A> +argv[1] = <\^A> +0000000 a $ ' \ 0 1 ' b \n a 001 b \n +0000015 +0000000 a $ ' \ 0 1 ' b \n a 001 b \n +0000015 +0000000 A \n A \n +0000004 diff --git a/tests/nquote.tests b/tests/nquote.tests index 068df365..e4d1a56f 100644 --- a/tests/nquote.tests +++ b/tests/nquote.tests @@ -139,3 +139,4 @@ ${THIS_SH} ./nquote1.sub ${THIS_SH} ./nquote2.sub ${THIS_SH} ./nquote3.sub ${THIS_SH} ./nquote4.sub +${THIS_SH} ./nquote5.sub diff --git a/tests/nquote5.sub b/tests/nquote5.sub new file mode 100644 index 00000000..8a2870e4 --- /dev/null +++ b/tests/nquote5.sub @@ -0,0 +1,22 @@ +recho $( echo a$'\01)'b ) +recho $( echo ab ) +recho $( echo \ ) +recho $( echo \\ ) + +LC_CTYPE=C +od -c <