]> git.ipfire.org Git - thirdparty/readline.git/commitdiff
add bindable readline variable `force-meta-prefix' to allow users to tell readline...
authorChet Ramey <chet.ramey@case.edu>
Fri, 23 Aug 2024 19:19:54 +0000 (15:19 -0400)
committerChet Ramey <chet.ramey@case.edu>
Fri, 23 Aug 2024 19:19:54 +0000 (15:19 -0400)
27 files changed:
CHANGELOG
Makefile.in
bind.c
configure
configure.ac
doc/history.0
doc/history.3
doc/history.info
doc/history.pdf
doc/hsuser.texi
doc/readline.0
doc/readline.3
doc/readline.info
doc/rltech.texi
doc/rluser.texi
doc/rluserman.info
doc/version.texi
examples/._rlwrap-0.46.1.tar.gz
histexpand.c
histfile.c
histlib.h
histsearch.c
mbutil.c
readline.c
rlmbutil.h
search.c
signals.c

index 8fd95137771fa43815688109390b08be393f03b2..783a097b1225c01de3a2f3ffe15c8af4d41d914e 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1486,3 +1486,9 @@ configure.ac
 configure.ac
        - add ncursesw as a possible value for TERMCAP_PKG_CONFIG_LIB, with
          corresponding changes to aclocal.m4, which is shared with bash
+
+                                  7/24
+                                  ----
+configure.ac,Makefile.in
+       - STYLE_CFLAGS: set like bash if we're using gcc or clang; add to
+         CCFLAGS so we can compile -Wno-parentheses by default
index 6c9de8b585c9434b27294f255b3235a8f76e1b04..00de1dfe558751b9547b3f381e7b0b7d51bb2bee 100644 (file)
@@ -1,6 +1,6 @@
 ## -*- text -*- ##
 # Master Makefile for the GNU readline library.
-# Copyright (C) 1994-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994-2024 Free Software Foundation, Inc.
 
 #   This program is free software: you can redistribute it and/or modify
 #   it under the terms of the GNU General Public License as published by
@@ -78,6 +78,7 @@ CFLAGS = @CFLAGS@
 LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DRL_LIBRARY_VERSION='"$(RL_LIBRARY_VERSION)"' @BRACKETED_PASTE@
 CPPFLAGS = @CPPFLAGS@
 
+STYLE_CFLAGS = @STYLE_CFLAGS@
 DEFS = @DEFS@ @CROSS_COMPILE@
 LOCAL_DEFS = @LOCAL_DEFS@
 
@@ -87,7 +88,7 @@ TERMCAP_LIB = @TERMCAP_LIB@
 INCLUDES = -I. -I$(srcdir)
 
 XCCFLAGS = $(ASAN_CFLAGS) $(DEFS) $(LOCAL_DEFS) $(INCLUDES) $(CPPFLAGS)
-CCFLAGS = $(XCCFLAGS) $(LOCAL_CFLAGS) $(CFLAGS)
+CCFLAGS = $(XCCFLAGS) $(LOCAL_CFLAGS) $(CFLAGS) $(STYLE_CFLAGS)
 
 # could add -Werror here
 GCC_LINT_FLAGS = -ansi -Wall -Wshadow -Wpointer-arith -Wcast-qual \
@@ -98,6 +99,9 @@ GCC_LINT_CFLAGS = $(XCCFLAGS) $(GCC_LINT_FLAGS) @CFLAGS@ @LOCAL_CFLAGS@
 ASAN_XCFLAGS = -fsanitize=address -fno-omit-frame-pointer
 ASAN_XLDFLAGS = -fsanitize=address
 
+UBSAN_XCFLAGS = -fsanitize=undefined -fsanitize-recover -fstack-protector
+UBSAN_XLDFLAGS = -fsanitize=undefined
+
 install_examples = @EXAMPLES_INSTALL_TARGET@
 
 .c.o:
diff --git a/bind.c b/bind.c
index b4f8004fc5374763afdacbbca2b3ab827ca2f9cb..21cfdf5631f7fa3005b7319de353adab6e3d164d 100644 (file)
--- a/bind.c
+++ b/bind.c
@@ -98,6 +98,15 @@ static int currently_reading_init_file;
 /* used only in this file */
 static int _rl_prefer_visible_bell = 1;
 
+/* Currently confined to this file for key bindings. If enabled (> 0), we
+   force meta key bindings to use the meta prefix (ESC). If unset (-1) or
+   disabled (0), we use the current value of _rl_convert_meta_chars_to_ascii
+   as in previous readline versions. */
+static int _rl_force_meta_prefix = 0;
+
+/* Do we want to force binding "\M-C" to the meta prefix (ESC-C)? */
+#define FORCE_META_PREFIX()    (_rl_force_meta_prefix > 0 ? 1 : _rl_convert_meta_chars_to_ascii)
+
 #define OP_EQ  1
 #define OP_NE  2
 #define OP_GT  3
@@ -137,7 +146,7 @@ rl_bind_key (int key, rl_command_func_t *function)
     return (key);
 
   /* Want to make this a multi-character key sequence with an ESC prefix */
-  if (META_CHAR (key) && _rl_convert_meta_chars_to_ascii)
+  if (META_CHAR (key) && FORCE_META_PREFIX())
     {
       if (_rl_keymap[ESC].type == ISKMAP)
        {
@@ -418,19 +427,8 @@ rl_generic_bind (int type, const char *keyseq, char *data, Keymap map)
          return -1;
         }
 
-      /* We now rely on rl_translate_keyseq to do this conversion, so this
-        check is superfluous. */
-#if 0
-      if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii)
-       {
-         ic = UNMETA (ic);
-         if (map[ESC].type == ISKMAP)
-           {
-             prevmap = map;
-             map = FUNCTION_TO_KEYMAP (map, ESC);
-           }
-       }
-#endif
+      /* We rely on rl_translate_keyseq to do convert meta-chars to key
+        sequences with the meta prefix (ESC). */
 
       if ((i + 1) < keys_len)
        {
@@ -617,14 +615,13 @@ rl_translate_keyseq (const char *seq, char *array, int *len)
          c = (c == '?') ? RUBOUT : CTRL (_rl_to_upper (c));
          has_control = 0;
        }
+
       if (has_meta)
-       {
-         c = META (c);
-         has_meta = 0;
-       }
+       c = META (c);
 
-      /* If convert-meta is turned on, convert a meta char to a key sequence */
-      if (META_CHAR (c) && _rl_convert_meta_chars_to_ascii)
+      /* If force-meta-prefix is turned on, convert a meta char to a key
+        sequence, but only if it uses the \M- syntax. */
+      if (META_CHAR (c) && has_meta && FORCE_META_PREFIX())
        {
          int x = UNMETA (c);
          if (x)
@@ -638,6 +635,8 @@ rl_translate_keyseq (const char *seq, char *array, int *len)
       else
        array[l++] = (c);
 
+      has_meta = 0;
+
       /* Null characters may be processed for incomplete prefixes at the end of
         sequence */
       if (seq[i] == '\0')
@@ -698,7 +697,7 @@ rl_untranslate_keyseq (int seq)
       c = UNMETA (c);
     }
 
-  if (c == ESC)
+  if (c == ESC)                /* look at _rl_force_meta_prefix here? */
     {
       kseq[i++] = '\\';
       c = 'e';
@@ -805,7 +804,7 @@ _rl_function_of_keyseq_internal (const char *keyseq, size_t len, Keymap map, int
     {
       unsigned char ic = keyseq[i];
 
-      if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii)
+      if (META_CHAR (ic) && FORCE_META_PREFIX())       /* XXX - might not want this */
        {
          if (map[ESC].type == ISKMAP)
            {
@@ -1888,6 +1887,7 @@ static const struct {
   { "enable-keypad",           &_rl_enable_keypad,             0 },
   { "enable-meta-key",         &_rl_enable_meta,               0 },
   { "expand-tilde",            &rl_complete_with_tilde_expansion, 0 },
+  { "force-meta-prefix",       &_rl_force_meta_prefix,         0 },
   { "history-preserve-point",  &_rl_history_preserve_point,    0 },
   { "horizontal-scroll-mode",  &_rl_horizontal_scroll_mode,    0 },
   { "input-meta",              &_rl_meta_flag,                 0 },
index 7b783822ffedda15e51e3647af31c4ea6d33ac45..eb2c1bfb32174a69fa52506d170d19e53140ed27 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac for Readline 8.3, version 2.99.
+# From configure.ac for Readline 8.3, version 2.101.
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.72 for readline 8.3.
 #
@@ -649,6 +649,7 @@ TERMCAP_PKG_CONFIG_LIB
 TERMCAP_LIB
 LIBVERSION
 ARFLAGS
+STYLE_CFLAGS
 LOCAL_DEFS
 LOCAL_LDFLAGS
 LOCAL_CFLAGS
@@ -7281,14 +7282,14 @@ if test "x$ac_cv_lib_curses_tgetent" = xyes
 then :
   bash_cv_termcap_lib=libcurses
 else case e in #(
-  e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncurses" >&5
-printf %s "checking for tgetent in -lncurses... " >&6; }
-if test ${ac_cv_lib_ncurses_tgetent+y}
+  e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncursesw" >&5
+printf %s "checking for tgetent in -lncursesw... " >&6; }
+if test ${ac_cv_lib_ncursesw_tgetent+y}
 then :
   printf %s "(cached) " >&6
 else case e in #(
   e) ac_check_lib_save_LIBS=$LIBS
-LIBS="-lncurses  $LIBS"
+LIBS="-lncursesw  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -7312,9 +7313,9 @@ return tgetent ();
 _ACEOF
 if ac_fn_c_try_link "$LINENO"
 then :
-  ac_cv_lib_ncurses_tgetent=yes
+  ac_cv_lib_ncursesw_tgetent=yes
 else case e in #(
-  e) ac_cv_lib_ncurses_tgetent=no ;;
+  e) ac_cv_lib_ncursesw_tgetent=no ;;
 esac
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.beam \
@@ -7322,20 +7323,20 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \
 LIBS=$ac_check_lib_save_LIBS ;;
 esac
 fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_tgetent" >&5
-printf "%s\n" "$ac_cv_lib_ncurses_tgetent" >&6; }
-if test "x$ac_cv_lib_ncurses_tgetent" = xyes
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_tgetent" >&5
+printf "%s\n" "$ac_cv_lib_ncursesw_tgetent" >&6; }
+if test "x$ac_cv_lib_ncursesw_tgetent" = xyes
 then :
-  bash_cv_termcap_lib=libncurses
+  bash_cv_termcap_lib=libncursesw
 else case e in #(
-  e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncursesw" >&5
-printf %s "checking for tgetent in -lncursesw... " >&6; }
-if test ${ac_cv_lib_ncursesw_tgetent+y}
+  e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncurses" >&5
+printf %s "checking for tgetent in -lncurses... " >&6; }
+if test ${ac_cv_lib_ncurses_tgetent+y}
 then :
   printf %s "(cached) " >&6
 else case e in #(
   e) ac_check_lib_save_LIBS=$LIBS
-LIBS="-lncursesw  $LIBS"
+LIBS="-lncurses  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -7359,9 +7360,9 @@ return tgetent ();
 _ACEOF
 if ac_fn_c_try_link "$LINENO"
 then :
-  ac_cv_lib_ncursesw_tgetent=yes
+  ac_cv_lib_ncurses_tgetent=yes
 else case e in #(
-  e) ac_cv_lib_ncursesw_tgetent=no ;;
+  e) ac_cv_lib_ncurses_tgetent=no ;;
 esac
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.beam \
@@ -7369,11 +7370,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \
 LIBS=$ac_check_lib_save_LIBS ;;
 esac
 fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_tgetent" >&5
-printf "%s\n" "$ac_cv_lib_ncursesw_tgetent" >&6; }
-if test "x$ac_cv_lib_ncursesw_tgetent" = xyes
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_tgetent" >&5
+printf "%s\n" "$ac_cv_lib_ncurses_tgetent" >&6; }
+if test "x$ac_cv_lib_ncurses_tgetent" = xyes
 then :
-  bash_cv_termcap_lib=libncursesw
+  bash_cv_termcap_lib=libncurses
 else case e in #(
   e) bash_cv_termcap_lib=gnutermcap ;;
 esac
@@ -7413,6 +7414,9 @@ TERMCAP_DEP=
 elif test $bash_cv_termcap_lib = libtinfo; then
 TERMCAP_LIB=-ltinfo
 TERMCAP_DEP=
+elif test $bash_cv_termcap_lib = libncursesw; then
+TERMCAP_LIB=-lncursesw
+TERMCAP_DEP=
 elif test $bash_cv_termcap_lib = libncurses; then
 TERMCAP_LIB=-lncurses
 TERMCAP_DEP=
@@ -7453,6 +7457,7 @@ esac
 case "$TERMCAP_LIB" in
 -ltinfo)  TERMCAP_PKG_CONFIG_LIB=tinfo ;;
 -lcurses) TERMCAP_PKG_CONFIG_LIB=ncurses ;;
+-lncursesw) TERMCAP_PKG_CONFIG_LIB=ncursesw ;;
 -lncurses) TERMCAP_PKG_CONFIG_LIB=ncurses ;;
 -ltermcap) TERMCAP_PKG_CONFIG_LIB=termcap ;;
 *) TERMCAP_PKG_CONFIG_LIB=termcap ;;
@@ -8065,6 +8070,7 @@ CFLAGS="$CFLAGS $STYLE_CFLAGS"
 
 
 
+
 ac_config_files="$ac_config_files Makefile doc/Makefile examples/Makefile shlib/Makefile readline.pc history.pc"
 
 
index 295e13ceee547f52f093644b187cb947563d7d97..1783dae872fe418400ad0fe7360297f651a65577 100644 (file)
@@ -20,7 +20,7 @@ dnl Process this file with autoconf to produce a configure script.
 #   You should have received a copy of the GNU General Public License
 #   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-AC_REVISION([for Readline 8.3, version 2.100])
+AC_REVISION([for Readline 8.3, version 2.101])
 
 AC_INIT(readline, 8.3, bug-readline@gnu.org)
 
@@ -328,6 +328,7 @@ AC_SUBST(CFLAGS)
 AC_SUBST(LOCAL_CFLAGS)
 AC_SUBST(LOCAL_LDFLAGS)
 AC_SUBST(LOCAL_DEFS)
+AC_SUBST(STYLE_CFLAGS)
 
 AC_SUBST(AR)
 AC_SUBST(ARFLAGS)
index 7abcb7d08c841dfda2aa473439581a050ddc9e45..71b0a003facaaaa729c39876e3057c4854d8cf4c 100644 (file)
@@ -88,7 +88,9 @@ H\bHI\bIS\bST\bTO\bOR\bRY\bY E\bEX\bXP\bPA\bAN\bNS\bSI\bIO\bON\bN
               pand to the zeroth word if there is only one word in the line.
        %\b%      The first word matched by the most recent "?_\bs_\bt_\br_\bi_\bn_\bg?"  search, if
               the search string begins with a character  that  is  part  of  a
-              word.
+              word.   By  default,  searches begin at the end of each line and
+              proceed to the beginning, so the first word matched is  the  one
+              closest to the end of the line.
        _\bx-\b-_\by    A range of words; "-_\by" abbreviates "0-_\by".
        *\b*      All  of  the words but the zeroth.  This is a synonym for "_\b1_\b-_\b$".
               It is not an error to use *\b* if there is just  one  word  in  the
@@ -513,4 +515,4 @@ B\bBU\bUG\bG R\bRE\bEP\bPO\bOR\bRT\bTS\bS
        Comments and bug reports concerning this manual page should be directed
        to _\bc_\bh_\be_\bt_\b._\br_\ba_\bm_\be_\by_\b@_\bc_\ba_\bs_\be_\b._\be_\bd_\bu.
 
-GNU History 8.3                  2024 March 29                      _\bH_\bI_\bS_\bT_\bO_\bR_\bY(3)
+GNU History 8.3                 2024 August 13                      _\bH_\bI_\bS_\bT_\bO_\bR_\bY(3)
index af31f1c592e522f214434b293b3d3c6ade4dbcc5..481cb2ee7fbc2e1640150fc0cc3548cf81bdb2cb 100644 (file)
@@ -6,9 +6,9 @@
 .\"    Case Western Reserve University
 .\"    chet.ramey@case.edu
 .\"
-.\"    Last Change: Fri Mar 29 12:03:51 EDT 2024
+.\"    Last Change: Tue Aug 13 14:29:23 EDT 2024
 .\"
-.TH HISTORY 3 "2024 March 29" "GNU History 8.3"
+.TH HISTORY 3 "2024 August 13" "GNU History 8.3"
 .\"
 .ie \n(.g \{\
 .ds ' \(aq
@@ -210,6 +210,9 @@ The first word matched by the most recent
 .Q ?\fIstring\fP?
 search,
 if the search string begins with a character that is part of a word.
+By default, searches begin at the end of each line and proceed to the
+beginning, so the first word matched is the one closest to the end of
+the line.
 .TP
 .I x\fB\-\fPy
 A range of words;
index b4ffe9a2e71504c8e3fce6ded543ec7d3dbcabe1..bed96808ac1bacf175964979effa4bc5842f9cb6 100644 (file)
@@ -1,7 +1,7 @@
 This is history.info, produced by makeinfo version 7.1 from
 history.texi.
 
-This document describes the GNU History library (version 8.3, 19 January
+This document describes the GNU History library (version 8.3, 13 August
 2024), a programming tool that provides a consistent user interface for
 recalling lines of previously typed input.
 
@@ -196,7 +196,10 @@ spaces.
 
 โ€˜%โ€™
      The first word matched by the most recent โ€˜?STRING?โ€™ search, if the
-     search string begins with a character that is part of a word.
+     search string begins with a character that is part of a word.  By
+     default, searches begin at the end of each line and proceed to the
+     beginning, so the first word matched is the one closest to the end
+     of the line.
 
 โ€˜X-Yโ€™
      A range of words; โ€˜-Yโ€™ abbreviates โ€˜0-Yโ€™.
@@ -1413,28 +1416,28 @@ Appendix C Function and Variable Index
 
 \1f
 Tag Table:
-Node: Top\7f847
-Node: Using History Interactively\7f1492
-Node: History Interaction\7f2000
-Node: Event Designators\7f4566
-Node: Word Designators\7f6073
-Node: Modifiers\7f8062
-Node: Programming with GNU History\7f9688
-Node: Introduction to History\7f10432
-Node: History Storage\7f12122
-Node: History Functions\7f13261
-Node: Initializing History and State Management\7f14250
-Node: History List Management\7f15062
-Node: Information About the History List\7f17372
-Node: Moving Around the History List\7f19014
-Node: Searching the History List\7f20115
-Node: Managing the History File\7f22044
-Node: History Expansion\7f23924
-Node: History Variables\7f25883
-Node: History Programming Example\7f29915
-Node: GNU Free Documentation License\7f32569
-Node: Concept Index\7f57744
-Node: Function and Variable Index\7f58449
+Node: Top\7f846
+Node: Using History Interactively\7f1491
+Node: History Interaction\7f1999
+Node: Event Designators\7f4565
+Node: Word Designators\7f6072
+Node: Modifiers\7f8227
+Node: Programming with GNU History\7f9853
+Node: Introduction to History\7f10597
+Node: History Storage\7f12287
+Node: History Functions\7f13426
+Node: Initializing History and State Management\7f14415
+Node: History List Management\7f15227
+Node: Information About the History List\7f17537
+Node: Moving Around the History List\7f19179
+Node: Searching the History List\7f20280
+Node: Managing the History File\7f22209
+Node: History Expansion\7f24089
+Node: History Variables\7f26048
+Node: History Programming Example\7f30080
+Node: GNU Free Documentation License\7f32734
+Node: Concept Index\7f57909
+Node: Function and Variable Index\7f58614
 \1f
 End Tag Table
 
index 79a9c2f903b549f0f55d444f944322464a805cd3..6028f63895e7d463ed780c8882b7ab647c62b4c4 100644 (file)
Binary files a/doc/history.pdf and b/doc/history.pdf differ
index 4c5dc84a1256a03b079eeb3010644b6b7b25347b..106c369ba4a5559c6d8286a7f06b7e4aa62d4a63 100644 (file)
@@ -468,6 +468,9 @@ The last argument.
 @item %
 The first word matched by the most recent @samp{?@var{string}?} search,
 if the search string begins with a character that is part of a word.
+By default, searches begin at the end of each line and proceed to the
+beginning, so the first word matched is the one closest to the end of
+the line.
 
 @item @var{x}-@var{y}
 A range of words; @samp{-@var{y}} abbreviates @samp{0-@var{y}}.
index c638199d16934aaeed4ab490acc457248098dbb8..16edc45be7d9d18cc3c8a7b62cd6beebddee6174 100644 (file)
@@ -571,9 +571,11 @@ E\bED\bDI\bIT\bTI\bIN\bNG\bG C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
 
    C\bCo\bom\bmm\bma\ban\bnd\bds\bs f\bfo\bor\br M\bMo\bov\bvi\bin\bng\bg
        b\bbe\beg\bgi\bin\bnn\bni\bin\bng\bg-\b-o\bof\bf-\b-l\bli\bin\bne\be (\b(C\bC-\b-a\ba)\b)
-              Move to the start of the current line.
+              Move  to  the start of the current line.  This may also be bound
+              to the Home key on some keyboards.
        e\ben\bnd\bd-\b-o\bof\bf-\b-l\bli\bin\bne\be (\b(C\bC-\b-e\be)\b)
-              Move to the end of the line.
+              Move to the end of the line.  This may also be bound to the  End
+              key on some keyboards.
        f\bfo\bor\brw\bwa\bar\brd\bd-\b-c\bch\bha\bar\br (\b(C\bC-\b-f\bf)\b)
               Move forward a character.
        b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-c\bch\bha\bar\br (\b(C\bC-\b-b\bb)\b)
@@ -653,46 +655,48 @@ E\bED\bDI\bIT\bTI\bIN\bNG\bG C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
               Search backward through the history for the string of characters
               between the start of the current line and the current cursor po-
               sition (the _\bp_\bo_\bi_\bn_\bt).  The search string must match at the  begin-
-              ning of a history line.  This is a non-incremental search.
+              ning of a history line.  This is a non-incremental search.  This
+              may be bound to the Page Up key on some keyboards.
        h\bhi\bis\bst\bto\bor\bry\by-\b-s\bse\bea\bar\brc\bch\bh-\b-f\bfo\bor\brw\bwa\bar\brd\bd
               Search  forward through the history for the string of characters
               between the start of the current line and the point.  The search
               string must match at the beginning of a history line.  This is a
-              non-incremental search.
+              non-incremental search.  This may be bound to the Page Down  key
+              on some keyboards.
        h\bhi\bis\bst\bto\bor\bry\by-\b-s\bsu\bub\bbs\bst\btr\bri\bin\bng\bg-\b-s\bse\bea\bar\brc\bch\bh-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd
               Search backward through the history for the string of characters
               between the start of the current line and the current cursor po-
-              sition (the _\bp_\bo_\bi_\bn_\bt).  The search string may match anywhere  in  a
+              sition  (the  _\bp_\bo_\bi_\bn_\bt).  The search string may match anywhere in a
               history line.  This is a non-incremental search.
        h\bhi\bis\bst\bto\bor\bry\by-\b-s\bsu\bub\bbs\bst\btr\bri\bin\bng\bg-\b-s\bse\bea\bar\brc\bch\bh-\b-f\bfo\bor\brw\bwa\bar\brd\bd
-              Search  forward through the history for the string of characters
+              Search forward through the history for the string of  characters
               between the start of the current line and the point.  The search
-              string may match anywhere in a history line.  This is a  non-in-
+              string  may match anywhere in a history line.  This is a non-in-
               cremental search.
        y\bya\ban\bnk\bk-\b-n\bnt\bth\bh-\b-a\bar\brg\bg (\b(M\bM-\b-C\bC-\b-y\by)\b)
-              Insert  the  first argument to the previous command (usually the
+              Insert the first argument to the previous command  (usually  the
               second word on the previous line) at point.  With an argument _\bn,
-              insert the _\bnth word from the previous command (the words in  the
-              previous  command  begin  with word 0).  A negative argument in-
-              serts the _\bnth word from the end of the previous  command.   Once
-              the  argument _\bn is computed, the argument is extracted as if the
+              insert  the _\bnth word from the previous command (the words in the
+              previous command begin with word 0).  A  negative  argument  in-
+              serts  the  _\bnth word from the end of the previous command.  Once
+              the argument _\bn is computed, the argument is extracted as if  the
               "!_\bn" history expansion had been specified.
        y\bya\ban\bnk\bk-\b-l\bla\bas\bst\bt-\b-a\bar\brg\bg (\b(M\bM-\b-.\b.,\b, M\bM-\b-_\b_)\b)
-              Insert the last argument to the previous command (the last  word
+              Insert  the last argument to the previous command (the last word
               of the previous history entry).  With a numeric argument, behave
-              exactly  like  y\bya\ban\bnk\bk-\b-n\bnt\bth\bh-\b-a\bar\brg\bg.   Successive calls to y\bya\ban\bnk\bk-\b-l\bla\bas\bst\bt-\b-a\bar\brg\bg
-              move back through the history list, inserting the last word  (or
-              the  word  specified  by the argument to the first call) of each
+              exactly like y\bya\ban\bnk\bk-\b-n\bnt\bth\bh-\b-a\bar\brg\bg.  Successive  calls  to  y\bya\ban\bnk\bk-\b-l\bla\bas\bst\bt-\b-a\bar\brg\bg
+              move  back through the history list, inserting the last word (or
+              the word specified by the argument to the first  call)  of  each
               line in turn.  Any numeric argument supplied to these successive
-              calls determines the direction to move through the  history.   A
-              negative  argument  switches  the  direction through the history
+              calls  determines  the direction to move through the history.  A
+              negative argument switches the  direction  through  the  history
               (back or forward).  The history expansion facilities are used to
-              extract the last argument, as if the "!$" history expansion  had
+              extract  the last argument, as if the "!$" history expansion had
               been specified.
 
    C\bCo\bom\bmm\bma\ban\bnd\bds\bs f\bfo\bor\br C\bCh\bha\ban\bng\bgi\bin\bng\bg T\bTe\bex\bxt\bt
        _\be_\bn_\bd_\b-_\bo_\bf_\b-_\bf_\bi_\bl_\be (\b(u\bus\bsu\bua\bal\bll\bly\by C\bC-\b-d\bd)\b)
-              The  character  indicating  end-of-file  as set, for example, by
+              The character indicating end-of-file as  set,  for  example,  by
               _\bs_\bt_\bt_\by(1).  If this character is read when there are no characters
               on the line, and point is at the beginning of the line, readline
               interprets it as the end of input and returns E\bEO\bOF\bF.
@@ -701,10 +705,10 @@ E\bED\bDI\bIT\bTI\bIN\bNG\bG C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
               same character as the tty E\bEO\bOF\bF character, as C\bC-\b-d\bd commonly is, see
               above for the effects.
        b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br (\b(R\bRu\bub\bbo\bou\but\bt)\b)
-              Delete the character behind the cursor.  When  given  a  numeric
+              Delete  the  character  behind the cursor.  When given a numeric
               argument, save the deleted text on the kill ring.
        f\bfo\bor\brw\bwa\bar\brd\bd-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br
-              Delete  the  character under the cursor, unless the cursor is at
+              Delete the character under the cursor, unless the cursor  is  at
               the end of the line, in which case the character behind the cur-
               sor is deleted.
        q\bqu\buo\bot\bte\bed\bd-\b-i\bin\bns\bse\ber\brt\bt (\b(C\bC-\b-q\bq,\b, C\bC-\b-v\bv)\b)
@@ -715,33 +719,34 @@ E\bED\bDI\bIT\bTI\bIN\bNG\bG C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
        s\bse\bel\blf\bf-\b-i\bin\bns\bse\ber\brt\bt (\b(a\ba,\b, b\bb,\b, A\bA,\b, 1\b1,\b, !\b!,\b, ...)\b)
               Insert the character typed.
        t\btr\bra\ban\bns\bsp\bpo\bos\bse\be-\b-c\bch\bha\bar\brs\bs (\b(C\bC-\b-t\bt)\b)
-              Drag the character before point forward over  the  character  at
-              point,  moving point forward as well.  If point is at the end of
-              the line, then this transposes the two characters before  point.
+              Drag  the  character  before point forward over the character at
+              point, moving point forward as well.  If point is at the end  of
+              the  line, then this transposes the two characters before point.
               Negative arguments have no effect.
        t\btr\bra\ban\bns\bsp\bpo\bos\bse\be-\b-w\bwo\bor\brd\bds\bs (\b(M\bM-\b-t\bt)\b)
-              Drag  the  word  before  point past the word after point, moving
-              point over that word as well.  If point is at  the  end  of  the
+              Drag the word before point past the  word  after  point,  moving
+              point  over  that  word  as well.  If point is at the end of the
               line, this transposes the last two words on the line.
        u\bup\bpc\bca\bas\bse\be-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-u\bu)\b)
-              Uppercase  the current (or following) word.  With a negative ar-
+              Uppercase the current (or following) word.  With a negative  ar-
               gument, uppercase the previous word, but do not move point.
        d\bdo\bow\bwn\bnc\bca\bas\bse\be-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-l\bl)\b)
-              Lowercase the current (or following) word.  With a negative  ar-
+              Lowercase  the current (or following) word.  With a negative ar-
               gument, lowercase the previous word, but do not move point.
        c\bca\bap\bpi\bit\bta\bal\bli\biz\bze\be-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-c\bc)\b)
               Capitalize the current (or following) word.  With a negative ar-
               gument, capitalize the previous word, but do not move point.
        o\bov\bve\ber\brw\bwr\bri\bit\bte\be-\b-m\bmo\bod\bde\be
-              Toggle  overwrite mode.  With an explicit positive numeric argu-
+              Toggle overwrite mode.  With an explicit positive numeric  argu-
               ment, switches to overwrite mode.  With an explicit non-positive
               numeric argument, switches to insert mode.  This command affects
-              only e\bem\bma\bac\bcs\bs mode; v\bvi\bi mode does overwrite differently.  Each  call
+              only  e\bem\bma\bac\bcs\bs mode; v\bvi\bi mode does overwrite differently.  Each call
               to _\br_\be_\ba_\bd_\bl_\bi_\bn_\be_\b(_\b) starts in insert mode.  In overwrite mode, charac-
-              ters  bound to s\bse\bel\blf\bf-\b-i\bin\bns\bse\ber\brt\bt replace the text at point rather than
-              pushing the text  to  the  right.   Characters  bound  to  b\bba\bac\bck\bk-\b-
-              w\bwa\bar\brd\bd-\b-d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br  replace  the  character  before  point  with a
-              space.  By default, this command is unbound.
+              ters bound to s\bse\bel\blf\bf-\b-i\bin\bns\bse\ber\brt\bt replace the text at point rather  than
+              pushing  the  text  to  the  right.   Characters  bound to b\bba\bac\bck\bk-\b-
+              w\bwa\bar\brd\bd-\b-d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br replace  the  character  before  point  with  a
+              space.  By default, this command is unbound, but may be bound to
+              the Insert key on some keyboards.
 
    K\bKi\bil\bll\bli\bin\bng\bg a\ban\bnd\bd Y\bYa\ban\bnk\bki\bin\bng\bg
        k\bki\bil\bll\bl-\b-l\bli\bin\bne\be (\b(C\bC-\b-k\bk)\b)
@@ -749,123 +754,123 @@ E\bED\bDI\bIT\bTI\bIN\bNG\bG C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
        b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-k\bki\bil\bll\bl-\b-l\bli\bin\bne\be (\b(C\bC-\b-x\bx R\bRu\bub\bbo\bou\but\bt)\b)
               Kill backward to the beginning of the line.
        u\bun\bni\bix\bx-\b-l\bli\bin\bne\be-\b-d\bdi\bis\bsc\bca\bar\brd\bd (\b(C\bC-\b-u\bu)\b)
-              Kill backward from point to the  beginning  of  the  line.   The
+              Kill  backward  from  point  to  the beginning of the line.  The
               killed text is saved on the kill-ring.
        k\bki\bil\bll\bl-\b-w\bwh\bho\bol\ble\be-\b-l\bli\bin\bne\be
-              Kill  all  characters on the current line, no matter where point
+              Kill all characters on the current line, no matter  where  point
               is.
        k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-d\bd)\b)
-              Kill from point the end of  the  current  word,  or  if  between
-              words,  to  the  end  of the next word.  Word boundaries are the
+              Kill  from  point  the  end  of  the current word, or if between
+              words, to the end of the next word.   Word  boundaries  are  the
               same as those used by f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
        b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-k\bki\bil\bll\bl-\b-w\bwo\bor\brd\bd (\b(M\bM-\b-R\bRu\bub\bbo\bou\but\bt)\b)
-              Kill the word behind point.  Word boundaries  are  the  same  as
+              Kill  the  word  behind  point.  Word boundaries are the same as
               those used by b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
        u\bun\bni\bix\bx-\b-w\bwo\bor\brd\bd-\b-r\bru\bub\bbo\bou\but\bt (\b(C\bC-\b-w\bw)\b)
-              Kill  the  word behind point, using white space as a word bound-
+              Kill the word behind point, using white space as a  word  bound-
               ary.  The killed text is saved on the kill-ring.
        u\bun\bni\bix\bx-\b-f\bfi\bil\ble\ben\bna\bam\bme\be-\b-r\bru\bub\bbo\bou\but\bt
-              Kill the word behind point, using  white  space  and  the  slash
-              character  as  the word boundaries.  The killed text is saved on
+              Kill  the  word  behind  point,  using white space and the slash
+              character as the word boundaries.  The killed text is  saved  on
               the kill-ring.
        d\bde\bel\ble\bet\bte\be-\b-h\bho\bor\bri\biz\bzo\bon\bnt\bta\bal\bl-\b-s\bsp\bpa\bac\bce\be (\b(M\bM-\b-\\b\)\b)
               Delete all spaces and tabs around point.
        k\bki\bil\bll\bl-\b-r\bre\beg\bgi\bio\bon\bn
-              Kill the text between the point and  _\bm_\ba_\br_\bk  (saved  cursor  posi-
+              Kill  the  text  between  the point and _\bm_\ba_\br_\bk (saved cursor posi-
               tion).  This text is referred to as the _\br_\be_\bg_\bi_\bo_\bn.
        c\bco\bop\bpy\by-\b-r\bre\beg\bgi\bio\bon\bn-\b-a\bas\bs-\b-k\bki\bil\bll\bl
               Copy the text in the region to the kill buffer.
        c\bco\bop\bpy\by-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd
-              Copy  the word before point to the kill buffer.  The word bound-
+              Copy the word before point to the kill buffer.  The word  bound-
               aries are the same as b\bba\bac\bck\bkw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
        c\bco\bop\bpy\by-\b-f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd
-              Copy the word following point to  the  kill  buffer.   The  word
+              Copy  the  word  following  point  to the kill buffer.  The word
               boundaries are the same as f\bfo\bor\brw\bwa\bar\brd\bd-\b-w\bwo\bor\brd\bd.
        y\bya\ban\bnk\bk (\b(C\bC-\b-y\by)\b)
               Yank the top of the kill ring into the buffer at point.
        y\bya\ban\bnk\bk-\b-p\bpo\bop\bp (\b(M\bM-\b-y\by)\b)
-              Rotate  the kill ring, and yank the new top.  Only works follow-
+              Rotate the kill ring, and yank the new top.  Only works  follow-
               ing y\bya\ban\bnk\bk or y\bya\ban\bnk\bk-\b-p\bpo\bop\bp.
 
    N\bNu\bum\bme\ber\bri\bic\bc A\bAr\brg\bgu\bum\bme\ben\bnt\bts\bs
        d\bdi\big\bgi\bit\bt-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt (\b(M\bM-\b-0\b0,\b, M\bM-\b-1\b1,\b, ...,\b, M\bM-\b--\b-)\b)
-              Add this digit to the argument already accumulating, or start  a
+              Add  this digit to the argument already accumulating, or start a
               new argument.  M-- starts a negative argument.
        u\bun\bni\biv\bve\ber\brs\bsa\bal\bl-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt
-              This  is another way to specify an argument.  If this command is
-              followed by one or more digits, optionally with a leading  minus
-              sign,  those digits define the argument.  If the command is fol-
+              This is another way to specify an argument.  If this command  is
+              followed  by one or more digits, optionally with a leading minus
+              sign, those digits define the argument.  If the command is  fol-
               lowed by digits, executing u\bun\bni\biv\bve\ber\brs\bsa\bal\bl-\b-a\bar\brg\bgu\bum\bme\ben\bnt\bt again ends the nu-
               meric argument, but is otherwise ignored.  As a special case, if
               this command is immediately followed by a character that is nei-
               ther a digit or minus sign, the argument count for the next com-
-              mand is multiplied by four.  The  argument  count  is  initially
-              one,  so  executing this function the first time makes the argu-
+              mand  is  multiplied  by  four.  The argument count is initially
+              one, so executing this function the first time makes  the  argu-
               ment count four, a second time makes the argument count sixteen,
               and so on.
 
    C\bCo\bom\bmp\bpl\ble\bet\bti\bin\bng\bg
        c\bco\bom\bmp\bpl\ble\bet\bte\be (\b(T\bTA\bAB\bB)\b)
               Attempt to perform completion on the text before point.  The ac-
-              tual completion performed is  application-specific.   B\bBa\bas\bsh\bh,  for
-              instance,  attempts  completion  treating the text as a variable
-              (if the text begins with $\b$), username (if the text  begins  with
-              ~\b~),  hostname (if the text begins with @\b@), or command (including
-              aliases and functions) in turn.  If none  of  these  produces  a
-              match,  filename  completion  is  attempted.   G\bGd\bdb\bb, on the other
-              hand, allows completion of program functions and variables,  and
+              tual  completion  performed  is application-specific.  B\bBa\bas\bsh\bh, for
+              instance, attempts completion treating the text  as  a  variable
+              (if  the  text begins with $\b$), username (if the text begins with
+              ~\b~), hostname (if the text begins with @\b@), or command  (including
+              aliases  and  functions)  in  turn.  If none of these produces a
+              match, filename completion is  attempted.   G\bGd\bdb\bb,  on  the  other
+              hand,  allows completion of program functions and variables, and
               only attempts filename completion under certain circumstances.
        p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(M\bM-\b-?\b?)\b)
-              List  the  possible  completions of the text before point.  When
+              List the possible completions of the text  before  point.   When
               displaying completions, readline sets the number of columns used
-              for display to the value of c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn-\b-d\bdi\bis\bsp\bpl\bla\bay\by-\b-w\bwi\bid\bdt\bth\bh, the  value
-              of  the  environment  variable  C\bCO\bOL\bLU\bUM\bMN\bNS\bS, or the screen width, in
+              for  display to the value of c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bn-\b-d\bdi\bis\bsp\bpl\bla\bay\by-\b-w\bwi\bid\bdt\bth\bh, the value
+              of the environment variable C\bCO\bOL\bLU\bUM\bMN\bNS\bS, or  the  screen  width,  in
               that order.
        i\bin\bns\bse\ber\brt\bt-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs (\b(M\bM-\b-*\b*)\b)
-              Insert all completions of the text before point that would  have
+              Insert  all completions of the text before point that would have
               been generated by p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs.
        m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be
-              Similar  to c\bco\bom\bmp\bpl\ble\bet\bte\be, but replaces the word to be completed with
-              a single match from the list of possible completions.   Repeated
-              execution  of  m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be  steps through the list of possible
-              completions, inserting each match in turn.  At the  end  of  the
+              Similar to c\bco\bom\bmp\bpl\ble\bet\bte\be, but replaces the word to be completed  with
+              a  single match from the list of possible completions.  Repeated
+              execution of m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be steps through the  list  of  possible
+              completions,  inserting  each  match in turn.  At the end of the
               list of completions, the bell is rung (subject to the setting of
               b\bbe\bel\bll\bl-\b-s\bst\bty\byl\ble\be) and the original text is restored.  An argument of _\bn
               moves _\bn positions forward in the list of matches; a negative ar-
               gument may be used to move backward through the list.  This com-
               mand is intended to be bound to T\bTA\bAB\bB, but is unbound by default.
        m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd
-              Identical  to m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be, but moves backward through the list
-              of possible completions, as if m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be had  been  given  a
+              Identical to m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be, but moves backward through the  list
+              of  possible  completions,  as if m\bme\ben\bnu\bu-\b-c\bco\bom\bmp\bpl\ble\bet\bte\be had been given a
               negative argument.  This command is unbound by default.
        d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br-\b-o\bor\br-\b-l\bli\bis\bst\bt
-              Deletes  the  character under the cursor if not at the beginning
-              or end of the line (like d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br).  If at  the  end  of  the
+              Deletes the character under the cursor if not at  the  beginning
+              or  end  of  the  line (like d\bde\bel\ble\bet\bte\be-\b-c\bch\bha\bar\br).  If at the end of the
               line, behaves identically to p\bpo\bos\bss\bsi\bib\bbl\ble\be-\b-c\bco\bom\bmp\bpl\ble\bet\bti\bio\bon\bns\bs.
 
    K\bKe\bey\byb\bbo\boa\bar\brd\bd M\bMa\bac\bcr\bro\bos\bs
        s\bst\bta\bar\brt\bt-\b-k\bkb\bbd\bd-\b-m\bma\bac\bcr\bro\bo (\b(C\bC-\b-x\bx (\b()\b)
-              Begin  saving  the  characters  typed  into the current keyboard
+              Begin saving the characters  typed  into  the  current  keyboard
               macro.
        e\ben\bnd\bd-\b-k\bkb\bbd\bd-\b-m\bma\bac\bcr\bro\bo (\b(C\bC-\b-x\bx )\b))\b)
               Stop saving the characters typed into the current keyboard macro
               and store the definition.
        c\bca\bal\bll\bl-\b-l\bla\bas\bst\bt-\b-k\bkb\bbd\bd-\b-m\bma\bac\bcr\bro\bo (\b(C\bC-\b-x\bx e\be)\b)
-              Re-execute the last keyboard macro defined, by making the  char-
+              Re-execute  the last keyboard macro defined, by making the char-
               acters in the macro appear as if typed at the keyboard.
        p\bpr\bri\bin\bnt\bt-\b-l\bla\bas\bst\bt-\b-k\bkb\bbd\bd-\b-m\bma\bac\bcr\bro\bo (\b()\b)
-              Print  the  last keyboard macro defined in a format suitable for
+              Print the last keyboard macro defined in a format  suitable  for
               the _\bi_\bn_\bp_\bu_\bt_\br_\bc file.
 
    M\bMi\bis\bsc\bce\bel\bll\bla\ban\bne\beo\bou\bus\bs
        r\bre\be-\b-r\bre\bea\bad\bd-\b-i\bin\bni\bit\bt-\b-f\bfi\bil\ble\be (\b(C\bC-\b-x\bx C\bC-\b-r\br)\b)
-              Read in the contents of the _\bi_\bn_\bp_\bu_\bt_\br_\bc file,  and  incorporate  any
+              Read  in  the  contents of the _\bi_\bn_\bp_\bu_\bt_\br_\bc file, and incorporate any
               bindings or variable assignments found there.
        a\bab\bbo\bor\brt\bt (\b(C\bC-\b-g\bg)\b)
-              Abort  the  current editing command and ring the terminal's bell
+              Abort the current editing command and ring the  terminal's  bell
               (subject to the setting of b\bbe\bel\bll\bl-\b-s\bst\bty\byl\ble\be).
        d\bdo\bo-\b-l\blo\bow\bwe\ber\brc\bca\bas\bse\be-\b-v\bve\ber\brs\bsi\bio\bon\bn (\b(M\bM-\b-A\bA,\b, M\bM-\b-B\bB,\b, M\bM-\b-_\bx,\b, ...)\b)
-              If the metafied character _\bx is uppercase, run the  command  that
+              If  the  metafied character _\bx is uppercase, run the command that
               is bound to the corresponding metafied lowercase character.  The
               behavior is undefined if _\bx is already lowercase.
        p\bpr\bre\bef\bfi\bix\bx-\b-m\bme\bet\bta\ba (\b(E\bES\bSC\bC)\b)
@@ -873,80 +878,80 @@ E\bED\bDI\bIT\bTI\bIN\bNG\bG C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
        u\bun\bnd\bdo\bo (\b(C\bC-\b-_\b_,\b, C\bC-\b-x\bx C\bC-\b-u\bu)\b)
               Incremental undo, separately remembered for each line.
        r\bre\bev\bve\ber\brt\bt-\b-l\bli\bin\bne\be (\b(M\bM-\b-r\br)\b)
-              Undo  all changes made to this line.  This is like executing the
-              u\bun\bnd\bdo\bcommand enough times to return  the  line  to  its  initial
+              Undo all changes made to this line.  This is like executing  the
+              u\bun\bnd\bdo\b command  enough  times  to  return the line to its initial
               state.
        t\bti\bil\bld\bde\be-\b-e\bex\bxp\bpa\ban\bnd\bd (\b(M\bM-\b-&\b&)\b)
               Perform tilde expansion on the current word.
        s\bse\bet\bt-\b-m\bma\bar\brk\bk (\b(C\bC-\b-@\b@,\b, M\bM-\b-<\b<s\bsp\bpa\bac\bce\be>\b>)\b)
-              Set  the  mark to the point.  If a numeric argument is supplied,
+              Set the mark to the point.  If a numeric argument  is  supplied,
               the mark is set to that position.
        e\bex\bxc\bch\bha\ban\bng\bge\be-\b-p\bpo\boi\bin\bnt\bt-\b-a\ban\bnd\bd-\b-m\bma\bar\brk\bk (\b(C\bC-\b-x\bx C\bC-\b-x\bx)\b)
-              Swap the point with the mark.  The current  cursor  position  is
-              set  to the saved position, and the old cursor position is saved
+              Swap  the  point  with the mark.  The current cursor position is
+              set to the saved position, and the old cursor position is  saved
               as the mark.
        c\bch\bha\bar\bra\bac\bct\bte\ber\br-\b-s\bse\bea\bar\brc\bch\bh (\b(C\bC-\b-]\b])\b)
               A character is read and point is moved to the next occurrence of
-              that character.  A negative argument searches for  previous  oc-
+              that  character.   A negative argument searches for previous oc-
               currences.
        c\bch\bha\bar\bra\bac\bct\bte\ber\br-\b-s\bse\bea\bar\brc\bch\bh-\b-b\bba\bac\bck\bkw\bwa\bar\brd\bd (\b(M\bM-\b-C\bC-\b-]\b])\b)
-              A  character  is  read and point is moved to the previous occur-
-              rence of that character.  A negative argument searches for  sub-
+              A character is read and point is moved to  the  previous  occur-
+              rence  of that character.  A negative argument searches for sub-
               sequent occurrences.
        s\bsk\bki\bip\bp-\b-c\bcs\bsi\bi-\b-s\bse\beq\bqu\bue\ben\bnc\bce\be
-              Read  enough  characters to consume a multi-key sequence such as
-              those defined for keys like Home and End.  Such sequences  begin
+              Read enough characters to consume a multi-key sequence  such  as
+              those  defined for keys like Home and End.  Such sequences begin
               with a Control Sequence Indicator (CSI), usually ESC-[.  If this
-              sequence  is  bound  to "\[", keys producing such sequences will
-              have no effect unless explicitly bound to  a  readline  command,
-              instead  of  inserting stray characters into the editing buffer.
+              sequence is bound to "\[", keys producing  such  sequences  will
+              have  no  effect  unless explicitly bound to a readline command,
+              instead of inserting stray characters into the  editing  buffer.
               This is unbound by default, but usually bound to ESC-[.
        i\bin\bns\bse\ber\brt\bt-\b-c\bco\bom\bmm\bme\ben\bnt\bt (\b(M\bM-\b-#\b#)\b)
-              Without a numeric argument,  the  value  of  the  readline  c\bco\bom\bm-\b-
-              m\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\b variable is inserted at the beginning of the current
+              Without  a  numeric  argument,  the  value  of the readline c\bco\bom\bm-\b-
+              m\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bvariable is inserted at the beginning of the  current
               line.  If a numeric argument is supplied, this command acts as a
-              toggle: if the characters at the beginning of the  line  do  not
-              match  the value of c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn, the value is inserted, other-
+              toggle:  if  the  characters at the beginning of the line do not
+              match the value of c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn, the value is inserted,  other-
               wise the characters in c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn are deleted from the begin-
-              ning of the line.  In either case, the line is accepted as if  a
-              newline  had  been  typed.   The  default value of c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn
-              makes the current line a shell comment.  If a  numeric  argument
+              ning  of the line.  In either case, the line is accepted as if a
+              newline had been typed.   The  default  value  of  c\bco\bom\bmm\bme\ben\bnt\bt-\b-b\bbe\beg\bgi\bin\bn
+              makes  the  current line a shell comment.  If a numeric argument
               causes the comment character to be removed, the line will be ex-
               ecuted by the shell.
        d\bdu\bum\bmp\bp-\b-f\bfu\bun\bnc\bct\bti\bio\bon\bns\bs
-              Print  all  of the functions and their key bindings to the read-
+              Print all of the functions and their key bindings to  the  read-
               line output stream.  If a numeric argument is supplied, the out-
-              put is formatted in such a way that it can be made  part  of  an
+              put  is  formatted  in such a way that it can be made part of an
               _\bi_\bn_\bp_\bu_\bt_\br_\bc file.
        d\bdu\bum\bmp\bp-\b-v\bva\bar\bri\bia\bab\bbl\ble\bes\bs
-              Print  all  of  the  settable  variables and their values to the
-              readline output stream.  If a numeric argument is supplied,  the
+              Print all of the settable variables  and  their  values  to  the
+              readline  output stream.  If a numeric argument is supplied, the
               output is formatted in such a way that it can be made part of an
               _\bi_\bn_\bp_\bu_\bt_\br_\bc file.
        d\bdu\bum\bmp\bp-\b-m\bma\bac\bcr\bro\bos\bs
-              Print  all of the readline key sequences bound to macros and the
-              strings they output.  If a numeric  argument  is  supplied,  the
+              Print all of the readline key sequences bound to macros and  the
+              strings  they  output.   If  a numeric argument is supplied, the
               output is formatted in such a way that it can be made part of an
               _\bi_\bn_\bp_\bu_\bt_\br_\bc file.
        e\bem\bma\bac\bcs\bs-\b-e\bed\bdi\bit\bti\bin\bng\bg-\b-m\bmo\bod\bde\be (\b(C\bC-\b-e\be)\b)
-              When  in  v\bvi\bi command mode, this causes a switch to e\bem\bma\bac\bcs\bs editing
+              When in v\bvi\bi command mode, this causes a switch to  e\bem\bma\bac\bcs\b editing
               mode.
        v\bvi\bi-\b-e\bed\bdi\bit\bti\bin\bng\bg-\b-m\bmo\bod\bde\be (\b(M\bM-\b-C\bC-\b-j\bj)\b)
-              When in e\bem\bma\bac\bcs\bs editing mode, this causes a switch to  v\bvi\b editing
+              When  in  e\bem\bma\bac\bcs\bs editing mode, this causes a switch to v\bvi\bi editing
               mode.
 
 D\bDE\bEF\bFA\bAU\bUL\bLT\bT K\bKE\bEY\bY B\bBI\bIN\bND\bDI\bIN\bNG\bGS\bS
-       The  following is a list of the default emacs and vi bindings.  Charac-
-       ters with the eighth bit set are written as M-<character>, and are  re-
-       ferred  to  as _\bm_\be_\bt_\ba_\bf_\bi_\be_\bd characters.  The printable ASCII characters not
-       mentioned in the list of emacs  standard  bindings  are  bound  to  the
-       s\bse\bel\blf\bf-\b-i\bin\bns\bse\ber\brt\b function,  which just inserts the given character into the
+       The following is a list of the default emacs and vi bindings.   Charac-
+       ters  with the eighth bit set are written as M-<character>, and are re-
+       ferred to as _\bm_\be_\bt_\ba_\bf_\bi_\be_\bd characters.  The printable ASCII  characters  not
+       mentioned  in  the  list  of  emacs  standard bindings are bound to the
+       s\bse\bel\blf\bf-\b-i\bin\bns\bse\ber\brt\bfunction, which just inserts the given character  into  the
        input line.  In vi insertion mode, all characters not specifically men-
        tioned are bound to s\bse\bel\blf\bf-\b-i\bin\bns\bse\ber\brt\bt.  Characters assigned to signal genera-
        tion by _\bs_\bt_\bt_\by(1) or the terminal driver, such as C-Z or C-C, retain that
-       function.  Upper and lower case metafied characters are  bound  to  the
-       same  function in the emacs mode meta keymap.  The remaining characters
-       are unbound, which causes readline to ring the  bell  (subject  to  the
+       function.   Upper  and  lower case metafied characters are bound to the
+       same function in the emacs mode meta keymap.  The remaining  characters
+       are  unbound,  which  causes  readline to ring the bell (subject to the
        setting of the b\bbe\bel\bll\bl-\b-s\bst\bty\byl\ble\be variable).
 
    E\bEm\bma\bac\bcs\bs M\bMo\bod\bde\be
@@ -1162,14 +1167,14 @@ A\bAU\bUT\bTH\bHO\bOR\bRS\bS
        chet.ramey@case.edu
 
 B\bBU\bUG\bG R\bRE\bEP\bPO\bOR\bRT\bTS\bS
-       If  you  find  a bug in r\bre\bea\bad\bdl\bli\bin\bne\be,\b, you should report it.  But first, you
-       should make sure that it really is a bug, and that it  appears  in  the
+       If you find a bug in r\bre\bea\bad\bdl\bli\bin\bne\be,\b, you should report it.   But  first,  you
+       should  make  sure  that it really is a bug, and that it appears in the
        latest version of the r\bre\bea\bad\bdl\bli\bin\bne\be library that you have.
 
-       Once  you have determined that a bug actually exists, mail a bug report
-       to _\bb_\bu_\bg_\b-_\br_\be_\ba_\bd_\bl_\bi_\bn_\be@_\bg_\bn_\bu_\b._\bo_\br_\bg.  If you have a fix, you are  welcome  to  mail
-       that  as  well!   Suggestions  and  `philosophical'  bug reports may be
-       mailed to  _\bb_\bu_\bg_\b-_\br_\be_\ba_\bd_\bl_\bi_\bn_\be@_\bg_\bn_\bu_\b._\bo_\br_\bg  or  posted  to  the  Usenet  newsgroup
+       Once you have determined that a bug actually exists, mail a bug  report
+       to  _\bb_\bu_\bg_\b-_\br_\be_\ba_\bd_\bl_\bi_\bn_\be@_\bg_\bn_\bu_\b._\bo_\br_\bg.   If  you have a fix, you are welcome to mail
+       that as well!  Suggestions  and  `philosophical'  bug  reports  may  be
+       mailed  to  _\bb_\bu_\bg_\b-_\br_\be_\ba_\bd_\bl_\bi_\bn_\be@_\bg_\bn_\bu_\b._\bo_\br_\bg  or  posted  to  the  Usenet newsgroup
        g\bgn\bnu\bu.\b.b\bba\bas\bsh\bh.\b.b\bbu\bug\bg.
 
        Comments and bug reports concerning this manual page should be directed
@@ -1178,4 +1183,4 @@ B\bBU\bUG\bG R\bRE\bEP\bPO\bOR\bRT\bTS\bS
 B\bBU\bUG\bGS\bS
        It's too big and too slow.
 
-GNU Readline 8.3                 2024 March 29                     _\bR_\bE_\bA_\bD_\bL_\bI_\bN_\bE(3)
+GNU Readline 8.3                  2024 May 11                      _\bR_\bE_\bA_\bD_\bL_\bI_\bN_\bE(3)
index b36333d374fcec2d52f7829986f3b46f37d934e2..3dbc85963ba9c5948c59539d69ea780d576486be 100644 (file)
@@ -6,9 +6,9 @@
 .\"    Case Western Reserve University
 .\"    chet.ramey@case.edu
 .\"
-.\"    Last Change: Sat May 11 12:44:56 EDT 2024
+.\"    Last Change: Fri Aug 23 09:04:51 EDT 2024
 .\"
-.TH READLINE 3 "2024 May 11" "GNU Readline 8.3"
+.TH READLINE 3 "2024 August 23" "GNU Readline 8.3"
 .\"
 .ie \n(.g \{\
 .ds ' \(aq
@@ -106,17 +106,31 @@ Control keys are denoted by C\-\fIkey\fP, e.g., C\-n means Control\-N.
 Similarly,
 .I meta
 keys are denoted by M\-\fIkey\fP, so M\-x means Meta\-X.
-(On keyboards without a
-.I meta
+.PP
+On keyboards without a
+.I Meta
 key, M\-\fIx\fP means ESC \fIx\fP, i.e., press the Escape key
 then the
 .I x
-key.  This makes ESC the \fImeta prefix\fP.
+key.
+This makes ESC the \fImeta prefix\fP.
 The combination M\-C\-\fIx\fP means ESC\-Control\-\fIx\fP,
 or press the Escape key
 then hold the Control key while pressing the
 .I x
-key.)
+key.
+.PP
+On some keyboards, the Meta key modifier produces meta characters with
+the eighth bit (0200) set (you can use the \fBenable\-meta\-key\fP variable
+to control whether or not it does this, if the keyboard allows it).
+On many others, the terminal or terminal emulator converts the metafied
+key to a key sequence beginning with ESC as described in the      
+preceding paragraph. 
+.PP
+If the \fIMeta\fP key produces a key sequence with the ESC meta prefix,
+you can make M-\fIkey\fP key bindings you specify (see
+.B "Readline Key Bindings"    
+below) do the same thing by setting the \fBforce\-meta\-prefix\fP variable. 
 .PP
 Readline commands may be given numeric
 .IR arguments ,
@@ -268,7 +282,8 @@ key sequences is
 control prefix
 .TP
 .B \eM\-
-meta prefix
+adding the meta prefix or converting the following character to a meta
+character, as described below under \fBforce-meta-prefix\fP
 .TP
 .B \ee
 an escape character
@@ -486,14 +501,17 @@ on the terminal.
 A negative value causes readline to never ask.
 .TP
 .B convert\-meta (On)
-If set to \fBOn\fP, readline will convert characters with the
-eighth bit set to an ASCII key sequence
-by stripping the eighth bit and prefixing it with an
-escape character (in effect, using escape as the \fImeta prefix\fP).
-The default is \fIOn\fP, but readline will set it to \fIOff\fP if the
-locale contains eight-bit characters.
+If set to \fBOn\fP, readline will convert characters it reads
+with the eighth bit set to an ASCII key sequence
+by stripping the eighth bit and prefixing it with an escape character
+(converting the character to have the \fImeta prefix\fP).
+The default is \fIOn\fP, but readline will set it to \fIOff\fP
+if the locale contains
+characters whose encodings may include bytes with the eighth bit set.
 This variable is dependent on the \fBLC_CTYPE\fP locale category, and
 may change if the locale is changed.
+This variable also affects key bindings; see the description of
+\fBforce\-meta\-prefix\fP below. 
 .TP
 .B disable\-completion (Off)
 If set to \fBOn\fP, readline will inhibit word completion.  Completion
@@ -551,13 +569,34 @@ arrow keys.
 .TP
 .B enable\-meta\-key (On)
 When set to \fBOn\fP, readline will try to enable any meta modifier
-key the terminal claims to support when it is called.  On many terminals,
-the meta key is used to send eight-bit characters.
+key the terminal claims to support when it is called.
+On many terminals, the Meta key is used to send eight-bit characters;
+this variable checks for the terminal capability that indicates the
+terminal can enable and disable a mode that sets the eighth bit of a
+character (0200) if the Meta key is held down when the character is
+typed (a meta character).
 .TP
 .B expand\-tilde (Off)
 If set to \fBOn\fP, tilde expansion is performed when readline
 attempts word completion.
 .TP
+.B force\-meta\-prefix (Off)
+If set to \fBOn\fP, readline modifies its behavior when binding key
+sequences containing \eM- or Meta-
+(see \fBKey Bindings\fP above) by converting a key sequence of the form
+\eM-\fIC\fP or Meta-\fIC\fP to the two-character sequence
+\fBESC\fP\fIC\fP (adding the meta prefix).
+If
+.B force\-meta\-prefix
+is set to \fBOff\fP (the default),
+readline uses the value of the
+.B convert\-meta
+variable to determine whether to perform this conversion:
+if \fBconvert\-meta\fP is \fBOn\fP,
+readline performs the conversion described above;
+if it is \fBOff\fP, Readline converts \fIC\fP to a meta character by
+setting the eighth bit (0200).
+.TP
 .B history\-preserve\-point (Off)
 If set to \fBOn\fP, the history code attempts to place point at the
 same location on each history line retrieved with \fBprevious-history\fP
@@ -582,11 +621,13 @@ This setting is automatically enabled for terminals of height 1.
 .B input\-meta (Off)
 If set to \fBOn\fP, readline will enable eight-bit input (that is,
 it will not clear the eighth bit in the characters it reads),
-regardless of what the terminal claims it can support.  The name
+regardless of what the terminal claims it can support.
+The name
 .B meta\-flag
 is a synonym for this variable.
-The default is \fIOff\fP, but readline will set it to \fIOn\fP if the
-locale contains eight-bit characters.
+The default is \fIOff\fP, but readline will set it to \fIOn\fP
+if the locale contains
+characters whose encodings may include bytes with the eighth bit set.
 This variable is dependent on the \fBLC_CTYPE\fP locale category, and
 may change if the locale is changed.
 .TP
@@ -653,8 +694,9 @@ the list.
 If set to \fBOn\fP, readline will display characters with the
 eighth bit set directly rather than as a meta-prefixed escape
 sequence.
-The default is \fIOff\fP, but readline will set it to \fIOn\fP if the
-locale contains eight-bit characters.
+The default is \fIOff\fP, but readline will set it to \fIOn\fP
+if the locale contains
+characters whose encodings may include bytes with the eighth bit set.
 This variable is dependent on the \fBLC_CTYPE\fP locale category, and
 may change if the locale is changed.
 .TP
@@ -1275,7 +1317,7 @@ end of the line (like \fBdelete-char\fP).
 If at the end of the line, behaves identically to
 \fBpossible-completions\fP.
 .PD
-.SS Keyboard Macros
+.SS "Keyboard Macros"
 .PD 0
 .TP
 .B start\-kbd\-macro (C\-x (\^)
index 64e7d6c02bc3a03bff4025a69842fb7256a507c5..9713a7ec5ae4b5bdce58c5349ab19ee641905b81 100644 (file)
@@ -1,6 +1,6 @@
 This is readline.info, produced by makeinfo version 7.1 from rlman.texi.
 
-This manual describes the GNU Readline Library (version 8.3, 19 January
+This manual describes the GNU Readline Library (version 8.3, 13 August
 2024), a library which aids in the consistency of user interface across
 discrete programs which provide a command line interface.
 
@@ -1057,10 +1057,12 @@ File: readline.info,  Node: Commands For Moving,  Next: Commands For History,  U
 -------------------------
 
 โ€˜beginning-of-line (C-a)โ€™
-     Move to the start of the current line.
+     Move to the start of the current line.  This may also be bound to
+     the Home key on some keyboards.
 
 โ€˜end-of-line (C-e)โ€™
-     Move to the end of the line.
+     Move to the end of the line.  This may also be bound to the End key
+     on some keyboards.
 
 โ€˜forward-char (C-f)โ€™
      Move forward a character.
@@ -1152,16 +1154,24 @@ File: readline.info,  Node: Commands For History,  Next: Commands For Text,  Pre
      a string supplied by the user.  The search string may match
      anywhere in a history line.
 
+โ€˜history-search-backward ()โ€™
+     Search backward through the history for the string of characters
+     between the start of the current line and the point.  The search
+     string must match at the beginning of a history line.  This is a
+     non-incremental search.  By default, this command is unbound, but
+     may be bound to the Page Down key on some keyboards.
+
 โ€˜history-search-forward ()โ€™
      Search forward through the history for the string of characters
      between the start of the current line and the point.  The search
      string must match at the beginning of a history line.  This is a
-     non-incremental search.  By default, this command is unbound.
+     non-incremental search.  By default, this command is unbound, but
+     may be bound to the Page Up key on some keyboards.
 
-โ€˜history-search-backward ()โ€™
+โ€˜history-substring-search-backward ()โ€™
      Search backward through the history for the string of characters
      between the start of the current line and the point.  The search
-     string must match at the beginning of a history line.  This is a
+     string may match anywhere in a history line.  This is a
      non-incremental search.  By default, this command is unbound.
 
 โ€˜history-substring-search-forward ()โ€™
@@ -1170,12 +1180,6 @@ File: readline.info,  Node: Commands For History,  Next: Commands For Text,  Pre
      string may match anywhere in a history line.  This is a
      non-incremental search.  By default, this command is unbound.
 
-โ€˜history-substring-search-backward ()โ€™
-     Search backward through the history for the string of characters
-     between the start of the current line and the point.  The search
-     string may match anywhere in a history line.  This is a
-     non-incremental search.  By default, this command is unbound.
-
 โ€˜yank-nth-arg (M-C-y)โ€™
      Insert the first argument to the previous command (usually the
      second word on the previous line) at point.  With an argument N,
@@ -1294,7 +1298,8 @@ File: readline.info,  Node: Commands For Text,  Next: Commands For Killing,  Pre
      Characters bound to โ€˜backward-delete-charโ€™ replace the character
      before point with a space.
 
-     By default, this command is unbound.
+     By default, this command is unbound, but may be bound to the Insert
+     key on some keyboards.
 
 \1f
 File: readline.info,  Node: Commands For Killing,  Next: Numeric Arguments,  Prev: Commands For Text,  Up: Bindable Readline Commands
@@ -2976,16 +2981,8 @@ changed.
        if (rl_point >= rl_end)
          return (0);
 
-       if (count < 0)
-         {
-           direction = -1;
-           count = -count;
-         }
-       else
-         direction = 1;
-
        /* Find the end of the range to modify. */
-       end = start + (count * direction);
+       end = start + count;
 
        /* Force it to be within range. */
        if (end > rl_end)
@@ -2996,6 +2993,11 @@ changed.
        if (start == end)
          return (0);
 
+       /* For positive arguments, put point after the last changed character. For
+          negative arguments, put point before the last changed character. */
+       rl_point = end;
+
+       /* Swap start and end if we are moving backwards */
        if (start > end)
          {
            int temp = start;
@@ -3014,8 +3016,7 @@ changed.
            else if (_rl_lowercase_p (rl_line_buffer[i]))
              rl_line_buffer[i] = _rl_to_upper (rl_line_buffer[i]);
          }
-       /* Move point to on top of the last character changed. */
-       rl_point = (direction == 1) ? end - 1 : start;
+
        return (0);
      }
 
@@ -3034,7 +3035,6 @@ understands the EOF character or "exit" to exit the program.
      #include <stdlib.h>
      #include <string.h>
      #include <unistd.h>
-     #include <locale.h>
 
      /* Used for select(2) */
      #include <sys/types.h>
@@ -3042,12 +3042,19 @@ understands the EOF character or "exit" to exit the program.
 
      #include <signal.h>
 
+     #include <errno.h>
      #include <stdio.h>
 
+     #include <locale.h>
+
      /* Standard readline include files. */
      #include <readline/readline.h>
      #include <readline/history.h>
 
+     #if !defined (errno)
+     extern int errno;
+     #endif
+
      static void cb_linehandler (char *);
      static void sighandler (int);
 
@@ -4795,13 +4802,13 @@ Function and Variable Index
                                                               (line  48)
 * active-region-start-color:             Readline Init File Syntax.
                                                               (line  35)
-* backward-char (C-b):                   Commands For Moving. (line  15)
+* backward-char (C-b):                   Commands For Moving. (line  17)
 * backward-delete-char (Rubout):         Commands For Text.   (line  17)
 * backward-kill-line (C-x Rubout):       Commands For Killing.
                                                               (line  11)
 * backward-kill-word (M-<DEL>):          Commands For Killing.
                                                               (line  28)
-* backward-word (M-b):                   Commands For Moving. (line  22)
+* backward-word (M-b):                   Commands For Moving. (line  24)
 * beginning-of-history (M-<):            Commands For History.
                                                               (line  19)
 * beginning-of-line (C-a):               Commands For Moving. (line   6)
@@ -4818,8 +4825,8 @@ Function and Variable Index
                                                               (line  42)
 * character-search-backward (M-C-]):     Miscellaneous Commands.
                                                               (line  47)
-* clear-display (M-C-l):                 Commands For Moving. (line  40)
-* clear-screen (C-l):                    Commands For Moving. (line  45)
+* clear-display (M-C-l):                 Commands For Moving. (line  42)
+* clear-screen (C-l):                    Commands For Moving. (line  47)
 * colored-completion-prefix:             Readline Init File Syntax.
                                                               (line  81)
 * colored-stats:                         Readline Init File Syntax.
@@ -4881,7 +4888,7 @@ Function and Variable Index
 * end-of-file (usually C-d):             Commands For Text.   (line   6)
 * end-of-history (M->):                  Commands For History.
                                                               (line  22)
-* end-of-line (C-e):                     Commands For Moving. (line   9)
+* end-of-line (C-e):                     Commands For Moving. (line  10)
 * exchange-point-and-mark (C-x C-x):     Miscellaneous Commands.
                                                               (line  37)
 * execute-named-command (M-x):           Miscellaneous Commands.
@@ -4889,24 +4896,24 @@ Function and Variable Index
 * expand-tilde:                          Readline Init File Syntax.
                                                               (line 207)
 * fetch-history ():                      Commands For History.
-                                                              (line 102)
+                                                              (line 104)
 * forward-backward-delete-char ():       Commands For Text.   (line  21)
-* forward-char (C-f):                    Commands For Moving. (line  12)
+* forward-char (C-f):                    Commands For Moving. (line  14)
 * forward-search-history (C-s):          Commands For History.
                                                               (line  32)
-* forward-word (M-f):                    Commands For Moving. (line  18)
+* forward-word (M-f):                    Commands For Moving. (line  20)
 * history-preserve-point:                Readline Init File Syntax.
                                                               (line 211)
 * history-search-backward ():            Commands For History.
-                                                              (line  56)
-* history-search-forward ():             Commands For History.
                                                               (line  50)
+* history-search-forward ():             Commands For History.
+                                                              (line  57)
 * history-size:                          Readline Init File Syntax.
                                                               (line 217)
 * history-substring-search-backward ():  Commands For History.
-                                                              (line  68)
+                                                              (line  64)
 * history-substring-search-forward ():   Commands For History.
-                                                              (line  62)
+                                                              (line  70)
 * horizontal-scroll-mode:                Readline Init File Syntax.
                                                               (line 226)
 * input-meta:                            Readline Init File Syntax.
@@ -4943,13 +4950,13 @@ Function and Variable Index
                                                               (line 235)
 * next-history (C-n):                    Commands For History.
                                                               (line  16)
-* next-screen-line ():                   Commands For Moving. (line  33)
+* next-screen-line ():                   Commands For Moving. (line  35)
 * non-incremental-forward-search-history (M-n): Commands For History.
                                                               (line  44)
 * non-incremental-reverse-search-history (M-p): Commands For History.
                                                               (line  38)
 * operate-and-get-next (C-o):            Commands For History.
-                                                              (line  95)
+                                                              (line  97)
 * output-meta:                           Readline Init File Syntax.
                                                               (line 304)
 * overwrite-mode ():                     Commands For Text.   (line  73)
@@ -4961,13 +4968,13 @@ Function and Variable Index
                                                               (line  19)
 * previous-history (C-p):                Commands For History.
                                                               (line  12)
-* previous-screen-line ():               Commands For Moving. (line  26)
+* previous-screen-line ():               Commands For Moving. (line  28)
 * print-last-kbd-macro ():               Keyboard Macros.     (line  17)
 * quoted-insert (C-q or C-v):            Commands For Text.   (line  26)
 * re-read-init-file (C-x C-r):           Miscellaneous Commands.
                                                               (line   6)
 * readline:                              Basic Behavior.      (line  12)
-* redraw-current-line ():                Commands For Moving. (line  49)
+* redraw-current-line ():                Commands For Moving. (line  51)
 * reverse-search-history (C-r):          Commands For History.
                                                               (line  26)
 * revert-all-at-newline:                 Readline Init File Syntax.
@@ -5309,68 +5316,68 @@ Function and Variable Index
 * yank (C-y):                            Commands For Killing.
                                                               (line  63)
 * yank-last-arg (M-. or M-_):            Commands For History.
-                                                              (line  83)
+                                                              (line  85)
 * yank-nth-arg (M-C-y):                  Commands For History.
-                                                              (line  74)
+                                                              (line  76)
 * yank-pop (M-y):                        Commands For Killing.
                                                               (line  66)
 
 
 \1f
 Tag Table:
-Node: Top\7f863
-Node: Command Line Editing\7f1588
-Node: Introduction and Notation\7f2240
-Node: Readline Interaction\7f3888
-Node: Readline Bare Essentials\7f5080
-Node: Readline Movement Commands\7f6902
-Node: Readline Killing Commands\7f7903
-Node: Readline Arguments\7f9885
-Node: Searching\7f10946
-Node: Readline Init File\7f13145
-Node: Readline Init File Syntax\7f14321
-Node: Conditional Init Constructs\7f38971
-Node: Sample Init File\7f43340
-Node: Bindable Readline Commands\7f46465
-Node: Commands For Moving\7f47536
-Node: Commands For History\7f49339
-Node: Commands For Text\7f54391
-Node: Commands For Killing\7f58186
-Node: Numeric Arguments\7f60655
-Node: Commands For Completion\7f61811
-Node: Keyboard Macros\7f63844
-Node: Miscellaneous Commands\7f64549
-Node: Readline vi Mode\7f68928
-Node: Programming with GNU Readline\7f70797
-Node: Basic Behavior\7f71783
-Node: Custom Functions\7f75769
-Node: Readline Typedefs\7f77288
-Node: Function Writing\7f79014
-Node: Readline Variables\7f80332
-Node: Readline Convenience Functions\7f94832
-Node: Function Naming\7f95908
-Node: Keymaps\7f97178
-Node: Binding Keys\7f100285
-Node: Associating Function Names and Bindings\7f104889
-Node: Allowing Undoing\7f108530
-Node: Redisplay\7f111152
-Node: Modifying Text\7f115307
-Node: Character Input\7f116558
-Node: Terminal Management\7f119707
-Node: Utility Functions\7f121566
-Node: Miscellaneous Functions\7f124962
-Node: Alternate Interface\7f128686
-Node: A Readline Example\7f131476
-Node: Alternate Interface Example\7f133427
-Node: Readline Signal Handling\7f136959
-Node: Custom Completers\7f146500
-Node: How Completing Works\7f147220
-Node: Completion Functions\7f150595
-Node: Completion Variables\7f154265
-Node: A Short Completion Example\7f171897
-Node: GNU Free Documentation License\7f184570
-Node: Concept Index\7f209747
-Node: Function and Variable Index\7f211268
+Node: Top\7f862
+Node: Command Line Editing\7f1587
+Node: Introduction and Notation\7f2239
+Node: Readline Interaction\7f3887
+Node: Readline Bare Essentials\7f5079
+Node: Readline Movement Commands\7f6901
+Node: Readline Killing Commands\7f7902
+Node: Readline Arguments\7f9884
+Node: Searching\7f10945
+Node: Readline Init File\7f13144
+Node: Readline Init File Syntax\7f14320
+Node: Conditional Init Constructs\7f38970
+Node: Sample Init File\7f43339
+Node: Bindable Readline Commands\7f46464
+Node: Commands For Moving\7f47535
+Node: Commands For History\7f49465
+Node: Commands For Text\7f54639
+Node: Commands For Killing\7f58493
+Node: Numeric Arguments\7f60962
+Node: Commands For Completion\7f62118
+Node: Keyboard Macros\7f64151
+Node: Miscellaneous Commands\7f64856
+Node: Readline vi Mode\7f69235
+Node: Programming with GNU Readline\7f71104
+Node: Basic Behavior\7f72090
+Node: Custom Functions\7f76076
+Node: Readline Typedefs\7f77595
+Node: Function Writing\7f79321
+Node: Readline Variables\7f80639
+Node: Readline Convenience Functions\7f95139
+Node: Function Naming\7f96215
+Node: Keymaps\7f97485
+Node: Binding Keys\7f100592
+Node: Associating Function Names and Bindings\7f105196
+Node: Allowing Undoing\7f108837
+Node: Redisplay\7f111459
+Node: Modifying Text\7f115614
+Node: Character Input\7f116865
+Node: Terminal Management\7f120014
+Node: Utility Functions\7f121873
+Node: Miscellaneous Functions\7f125269
+Node: Alternate Interface\7f128993
+Node: A Readline Example\7f131783
+Node: Alternate Interface Example\7f133710
+Node: Readline Signal Handling\7f137329
+Node: Custom Completers\7f146870
+Node: How Completing Works\7f147590
+Node: Completion Functions\7f150965
+Node: Completion Variables\7f154635
+Node: A Short Completion Example\7f172267
+Node: GNU Free Documentation License\7f184940
+Node: Concept Index\7f210117
+Node: Function and Variable Index\7f211638
 \1f
 End Tag Table
 
index 56519d532e0dc8cdb5a0cd75d4f3ba653039394b..0aa73ef6d98137ec97f1567fb788716b294c17b3 100644 (file)
@@ -496,7 +496,7 @@ setting @var{rl_input_available_hook} as well.
 @end deftypevar
 
 @deftypevar {rl_voidfunc_t *} rl_redisplay_function
-If non-zero, Readline will call indirectly through this pointer
+Readline will call indirectly through this pointer
 to update the display with the current contents of the editing buffer.
 By default, it is set to @code{rl_redisplay}, the default Readline
 redisplay function (@pxref{Redisplay}).
index bc57ccf798320c4faaf56df5de2614767626da1a..5bcbaa292c5817af062d658c812e2e5e05333bad 100644 (file)
@@ -91,7 +91,7 @@ is depressed.
 
 The text @kbd{M-k} is read as `Meta-K' and describes the character
 produced when the Meta key (if you have one) is depressed, and the @key{k}
-key is pressed.
+key is pressed (a @dfn{meta character}).
 The Meta key is labeled @key{ALT} on many keyboards.
 On keyboards with two keys labeled @key{ALT} (usually to either side of
 the space bar), the @key{ALT} on the left side is generally set to
@@ -100,13 +100,22 @@ The @key{ALT} key on the right may also be configured to work as a
 Meta key or may be configured as some other modifier, such as a
 Compose key for typing accented characters.
 
+On some keyboards, the Meta key modifier produces meta characters with
+the eighth bit (0200) set (you can use the @code{enable-meta-key} variable
+to control whether or not it does this, if the keyboard allows it).
+On many others, the terminal or terminal emulator converts the metafied
+key to a key sequence beginning with @key{ESC} as described in the
+next paragraph.
+
 If you do not have a Meta or @key{ALT} key, or another key working as
-a Meta key, the identical keystroke can be generated by typing @key{ESC}
+a Meta key, you can generally achieve the latter effect by typing @key{ESC}
 @emph{first}, and then typing @key{k}.
+The @key{ESC} character is known as the @dfn{meta prefix}).
+
 Either process is known as @dfn{metafying} the @key{k} key.
 
 The text @kbd{M-C-k} is read as `Meta-Control-k' and describes the
-character produced by @dfn{metafying} @kbd{C-k}.
+character produced by metafying @kbd{C-k}.
 
 In addition, several keys have their own names.  Specifically,
 @key{DEL}, @key{ESC}, @key{LFD}, @key{SPC}, @key{RET}, and @key{TAB} all
@@ -541,15 +550,17 @@ The default limit is @code{100}.
 
 @item convert-meta
 @vindex convert-meta
-If set to @samp{on}, Readline will convert characters with the
-eighth bit set to an @sc{ascii} key sequence by stripping the eighth
-bit and prefixing an @key{ESC} character, converting them to a
-meta-prefixed key sequence.
-The default value is @samp{on}, but
-will be set to @samp{off} if the locale is one that contains
-eight-bit characters.
+If set to @samp{on}, Readline will convert characters it reads
+with the eighth bit set to an @sc{ascii} key sequence
+by stripping the eighth bit and prefixing an @key{ESC} character,
+converting them to a meta-prefixed key sequence.
+The default value is @samp{on}, but Readline will set it to @samp{off}
+if the locale contains
+characters whose encodings may include bytes with the eighth bit set.
 This variable is dependent on the @code{LC_CTYPE} locale category, and
 may change if the locale is changed.
+This variable also affects key bindings; see the description of
+@code{force-meta-prefix} below.
 
 @item disable-completion
 @vindex disable-completion
@@ -615,8 +626,12 @@ arrow keys.  The default is @samp{off}.
 
 @item enable-meta-key
 When set to @samp{on}, Readline will try to enable any meta modifier
-key the terminal claims to support when it is called.  On many terminals,
-the meta key is used to send eight-bit characters.
+key the terminal claims to support when it is called.
+On many terminals, the Meta key is used to send eight-bit characters;
+this variable checks for the terminal capability that indicates the
+terminal can enable and disable a mode that sets the eighth bit of a
+character (0200) if the Meta key is held down when the character is
+typed (a meta character).
 The default is @samp{on}.
 
 @item expand-tilde
@@ -624,6 +639,22 @@ The default is @samp{on}.
 If set to @samp{on}, tilde expansion is performed when Readline
 attempts word completion.  The default is @samp{off}.
 
+@item force-meta-prefix
+@vindex force-meta-prefix
+If set to @samp{on}, Readline modifies its behavior when binding key
+sequences containing @kbd{\M-} or @code{Meta-}
+(@pxref{Key Bindings}) by converting a key sequence of the form
+@kbd{\M-}@var{C} or @code{Meta-}@var{C} to the two-character sequence
+@kbd{ESC}@var{C} (adding the meta prefix).
+If @code{force-meta-prefix} is set to @samp{off} (the default),
+Readline uses the value of the @code{convert-meta} variable to determine
+whether to perform this conversion:
+if @code{convert-meta} is @samp{on},
+Readline performs the conversion described above;
+if it is @samp{off}, Readline converts @var{C} to a meta character by
+setting the eighth bit (0200).
+The default is @samp{off}.
+
 @item history-preserve-point
 @vindex history-preserve-point
 If set to @samp{on}, the history code attempts to place the point (the
@@ -657,8 +688,9 @@ By default, this variable is set to @samp{off}.
 If set to @samp{on}, Readline will enable eight-bit input (it
 will not clear the eighth bit in the characters it reads),
 regardless of what the terminal claims it can support.  The
-default value is @samp{off}, but Readline will set it to @samp{on} if the 
-locale contains eight-bit characters.
+default value is @samp{off}, but Readline will set it to @samp{on}
+if the locale contains
+characters whose encodings may include bytes with the eighth bit set.
 The name @code{meta-flag} is a synonym for this variable.
 This variable is dependent on the @code{LC_CTYPE} locale category, and
 may change if the locale is changed.
@@ -742,8 +774,9 @@ the list.  The default is @samp{off}.
 If set to @samp{on}, Readline will display characters with the
 eighth bit set directly rather than as a meta-prefixed escape
 sequence.
-The default is @samp{off}, but Readline will set it to @samp{on} if the
-locale contains eight-bit characters.
+The default is @samp{off}, but Readline will set it to @samp{on}
+if the locale contains
+characters whose encodings may include bytes with the eighth bit set.
 This variable is dependent on the @code{LC_CTYPE} locale category, and
 may change if the locale is changed.
 
@@ -929,7 +962,9 @@ specifying key sequences:
 @item @kbd{\C-}
 control prefix
 @item @kbd{\M-}
-meta prefix
+adding the meta prefix or converting the following character to a meta
+character, as described above under @code{force-meta-prefix}
+(@pxref{Variable Settings}).
 @item @kbd{\e}
 an escape character
 @item @kbd{\\}
index e432a35092a5641acd56212807dc053cec096da3..f09c65eb82757408422a334dc1a7ef0b1b187a7f 100644 (file)
@@ -2,7 +2,7 @@ This is rluserman.info, produced by makeinfo version 7.1 from
 rluserman.texi.
 
 This manual describes the end user interface of the GNU Readline Library
-(version 8.3, 19 January 2024), a library which aids in the consistency
+(version 8.3, 13 August 2024), a library which aids in the consistency
 of user interface across discrete programs which provide a command line
 interface.
 
@@ -1055,10 +1055,12 @@ File: rluserman.info,  Node: Commands For Moving,  Next: Commands For History,
 -------------------------
 
 โ€˜beginning-of-line (C-a)โ€™
-     Move to the start of the current line.
+     Move to the start of the current line.  This may also be bound to
+     the Home key on some keyboards.
 
 โ€˜end-of-line (C-e)โ€™
-     Move to the end of the line.
+     Move to the end of the line.  This may also be bound to the End key
+     on some keyboards.
 
 โ€˜forward-char (C-f)โ€™
      Move forward a character.
@@ -1150,16 +1152,24 @@ File: rluserman.info,  Node: Commands For History,  Next: Commands For Text,  Pr
      a string supplied by the user.  The search string may match
      anywhere in a history line.
 
+โ€˜history-search-backward ()โ€™
+     Search backward through the history for the string of characters
+     between the start of the current line and the point.  The search
+     string must match at the beginning of a history line.  This is a
+     non-incremental search.  By default, this command is unbound, but
+     may be bound to the Page Down key on some keyboards.
+
 โ€˜history-search-forward ()โ€™
      Search forward through the history for the string of characters
      between the start of the current line and the point.  The search
      string must match at the beginning of a history line.  This is a
-     non-incremental search.  By default, this command is unbound.
+     non-incremental search.  By default, this command is unbound, but
+     may be bound to the Page Up key on some keyboards.
 
-โ€˜history-search-backward ()โ€™
+โ€˜history-substring-search-backward ()โ€™
      Search backward through the history for the string of characters
      between the start of the current line and the point.  The search
-     string must match at the beginning of a history line.  This is a
+     string may match anywhere in a history line.  This is a
      non-incremental search.  By default, this command is unbound.
 
 โ€˜history-substring-search-forward ()โ€™
@@ -1168,12 +1178,6 @@ File: rluserman.info,  Node: Commands For History,  Next: Commands For Text,  Pr
      string may match anywhere in a history line.  This is a
      non-incremental search.  By default, this command is unbound.
 
-โ€˜history-substring-search-backward ()โ€™
-     Search backward through the history for the string of characters
-     between the start of the current line and the point.  The search
-     string may match anywhere in a history line.  This is a
-     non-incremental search.  By default, this command is unbound.
-
 โ€˜yank-nth-arg (M-C-y)โ€™
      Insert the first argument to the previous command (usually the
      second word on the previous line) at point.  With an argument N,
@@ -1292,7 +1296,8 @@ File: rluserman.info,  Node: Commands For Text,  Next: Commands For Killing,  Pr
      Characters bound to โ€˜backward-delete-charโ€™ replace the character
      before point with a space.
 
-     By default, this command is unbound.
+     By default, this command is unbound, but may be bound to the Insert
+     key on some keyboards.
 
 \1f
 File: rluserman.info,  Node: Commands For Killing,  Next: Numeric Arguments,  Prev: Commands For Text,  Up: Bindable Readline Commands
@@ -2062,30 +2067,30 @@ their use in free software.
 
 \1f
 Tag Table:
-Node: Top\7f906
-Node: Command Line Editing\7f1428
-Node: Introduction and Notation\7f2082
-Node: Readline Interaction\7f3731
-Node: Readline Bare Essentials\7f4924
-Node: Readline Movement Commands\7f6747
-Node: Readline Killing Commands\7f7749
-Node: Readline Arguments\7f9732
-Node: Searching\7f10794
-Node: Readline Init File\7f12994
-Node: Readline Init File Syntax\7f14171
-Node: Conditional Init Constructs\7f38822
-Node: Sample Init File\7f43192
-Node: Bindable Readline Commands\7f46318
-Node: Commands For Moving\7f47390
-Node: Commands For History\7f49194
-Node: Commands For Text\7f54247
-Node: Commands For Killing\7f58043
-Node: Numeric Arguments\7f60513
-Node: Commands For Completion\7f61670
-Node: Keyboard Macros\7f63704
-Node: Miscellaneous Commands\7f64410
-Node: Readline vi Mode\7f68790
-Node: GNU Free Documentation License\7f69756
+Node: Top\7f905
+Node: Command Line Editing\7f1427
+Node: Introduction and Notation\7f2081
+Node: Readline Interaction\7f3730
+Node: Readline Bare Essentials\7f4923
+Node: Readline Movement Commands\7f6746
+Node: Readline Killing Commands\7f7748
+Node: Readline Arguments\7f9731
+Node: Searching\7f10793
+Node: Readline Init File\7f12993
+Node: Readline Init File Syntax\7f14170
+Node: Conditional Init Constructs\7f38821
+Node: Sample Init File\7f43191
+Node: Bindable Readline Commands\7f46317
+Node: Commands For Moving\7f47389
+Node: Commands For History\7f49320
+Node: Commands For Text\7f54495
+Node: Commands For Killing\7f58350
+Node: Numeric Arguments\7f60820
+Node: Commands For Completion\7f61977
+Node: Keyboard Macros\7f64011
+Node: Miscellaneous Commands\7f64717
+Node: Readline vi Mode\7f69097
+Node: GNU Free Documentation License\7f70063
 \1f
 End Tag Table
 
index 9c8540c9a143e026c78cc395f177f862b0361508..9093f37145c68f1c60543a74f4c39d06fcb83311 100644 (file)
@@ -5,7 +5,7 @@ Copyright (C) 1988-2024 Free Software Foundation, Inc.
 @set EDITION 8.3
 @set VERSION 8.3
 
-@set UPDATED 11 May 2024
-@set UPDATED-MONTH May 2024
+@set UPDATED 23 August 2024
+@set UPDATED-MONTH August 2024
 
-@set LASTCHANGE Sat May 11 12:41:28 EDT 2024
+@set LASTCHANGE Fri Aug 23 09:46:18 EDT 2024
index 05479191bffbde8da6bf2424996b3db4f2c01da6..32794ccb6537e5d93a1fd8bde85e21521339f064 100644 (file)
Binary files a/examples/._rlwrap-0.46.1.tar.gz and b/examples/._rlwrap-0.46.1.tar.gz differ
index 8a28cbd01e0797253f03aefd4f642a6c4bd35a13..f67acd73cd9bf3cce29a597671b9499347e933c1 100644 (file)
@@ -1,6 +1,6 @@
 /* histexpand.c -- history expansion. */
 
-/* Copyright (C) 1989-2021,2023 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2021,2023-2024 Free Software Foundation, Inc.
 
    This file contains the GNU History Library (History), a set of
    routines for managing the text of previously typed lines.
@@ -90,8 +90,7 @@ char history_subst_char = '^';
 
 /* During tokenization, if this character is seen as the first character
    of a word, then it, and all subsequent characters up to a newline are
-   ignored.  For a Bourne shell, this should be '#'.  Bash special cases
-   the interactive comment character to not be a comment delimiter. */
+   ignored.  For a Bourne shell, this should be '#'. */
 char history_comment_char = '\0';
 
 /* The list of characters which inhibit the expansion of text if found
@@ -142,7 +141,7 @@ get_history_event (const char *string, int *caller_index, int delimiting_quote)
   register char c;
   HIST_ENTRY *entry;
   int which, sign, local_index, substring_okay;
-  _hist_search_func_t *search_func;
+  int search_flags;
   char *temp;
 
   /* The event can be specified in a number of ways.
@@ -270,10 +269,10 @@ get_history_event (const char *string, int *caller_index, int delimiting_quote)
         FAIL_SEARCH ();
     }
 
-  search_func = substring_okay ? history_search : history_search_prefix;
+  search_flags = substring_okay ? NON_ANCHORED_SEARCH : ANCHORED_SEARCH;
   while (1)
     {
-      local_index = (*search_func) (temp, -1);
+      local_index = _hs_history_search (temp, -1, -1, search_flags);
 
       if (local_index < 0)
        FAIL_SEARCH ();
index e11592237d4d4a052a7d333ae50b6d4d52b4a567..34c999f5823a88d53ed54d38a0c735682206bcb8 100644 (file)
@@ -745,6 +745,9 @@ history_do_write (const char *filename, int nelements, int overwrite)
 
   history_lines_written_to_file = 0;
 
+  if (nelements < 0)
+    return (0);
+
   mode = overwrite ? O_RDWR|O_CREAT|O_TRUNC|O_BINARY : O_RDWR|O_APPEND|O_BINARY;
 #else
   mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY;
index da8e6533dd5fd78ff013d746b2d659b8289d0252..d41b4ea12c62d0af404c483affa15640d871d8ff 100644 (file)
--- a/histlib.h
+++ b/histlib.h
@@ -83,8 +83,8 @@
 /* internal extern function declarations used by other parts of the library */
 
 /* histsearch.c */
-extern int _hs_history_patsearch (const char *, int, int);
-extern int _hs_history_search (const char *, int, int);
+extern int _hs_history_patsearch (const char *, int, int, int);
+extern int _hs_history_search (const char *, int, int, int);
 
 /* history.c */
 extern void _hs_replace_history_data (int, histdata_t *, histdata_t *);
index b43ead1ffea461311419d8666b78fe0a4c904827..36c469963c994ef998ccdb570946321136305c52 100644 (file)
@@ -1,6 +1,6 @@
 /* histsearch.c -- searching the history list. */
 
-/* Copyright (C) 1989, 1992-2009,2017,2021,2023 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1992-2009,2017,2021-2024 Free Software Foundation, Inc.
 
    This file contains the GNU History Library (History), a set of
    routines for managing the text of previously typed lines.
    string. */
 char *history_search_delimiter_chars = (char *)NULL;
 
-static int history_search_internal (const char *, int, int);
+static int history_search_internal (const char *, int, int, int);
 
 /* Search the history for STRING, starting at history_offset.
-   If DIRECTION < 0, then the search is through previous entries, else
-   through subsequent.  If ANCHORED is non-zero, the string must
+   If LISTDIR < 0, then the search is through previous entries, else
+   through subsequent. If ANCHORED is non-zero, the string must
    appear at the beginning of a history line, otherwise, the string
-   may appear anywhere in the line.  If PATSEARCH is non-zero, and fnmatch(3)
-   is available, fnmatch is used to match the string instead of a simple
-   string comparison. If IGNORECASE is set, the string comparison is
-   performed case-insensitively. If the string is found, then
+   may appear anywhere in the line. If the search is not anchored, LINEDIR
+   determines how the line is searched: if it is < 0, the search proceeds
+   from the end of the line to the beginning, otherwise the substring search
+   starts at the beginning of each history entry. If PATSEARCH is non-zero,
+   and fnmatch(3) is available, fnmatch is used to match the string instead
+   of a simple string comparison. If IGNORECASE is set, the string comparison
+   is performed case-insensitively. If the string is found, then
    current_history () is the history entry, and the value of this
-   function is the offset in the line of that history entry that the
-   string was found in.  Otherwise, nothing is changed, and a -1 is
-   returned. */
+   function is the offset in the line of that history entry in which the
+   string was found. Otherwise, nothing is changed, and a -1 is returned. */
 
 static int
-history_search_internal (const char *string, int direction, int flags)
+history_search_internal (const char *string, int listdir, int linedir, int flags)
 {
   int i, reverse;
   char *line;
@@ -80,7 +82,7 @@ history_search_internal (const char *string, int direction, int flags)
   HIST_ENTRY **the_history;    /* local */
 
   i = history_offset;
-  reverse = (direction < 0);
+  reverse = (listdir < 0);
   anchored = (flags & ANCHORED_SEARCH);
 #if defined (HAVE_FNMATCH)
   patsearch = (flags & PATTERN_SEARCH);
@@ -157,7 +159,7 @@ history_search_internal (const char *string, int direction, int flags)
        }
 
       /* Do substring search. */
-      if (reverse)
+      if (linedir < 0)         /* search backwards from end */
        {
          size_t ll;
 
@@ -240,7 +242,7 @@ history_search_internal (const char *string, int direction, int flags)
 }
 
 int
-_hs_history_patsearch (const char *string, int direction, int flags)
+_hs_history_patsearch (const char *string, int listdir, int linedir, int flags)
 {
   char *pat;
   size_t len, start;
@@ -289,45 +291,48 @@ _hs_history_patsearch (const char *string, int direction, int flags)
   pat = string;
 #endif
 
-  ret = history_search_internal (pat, direction, flags|PATTERN_SEARCH);
+  ret = history_search_internal (pat, listdir, linedir, flags|PATTERN_SEARCH);
 
   if (pat != string)
     xfree (pat);
   return ret;
 }
        
-/* Do a non-anchored search for STRING through the history in DIRECTION. */
+/* Do a non-anchored search for STRING through the history list in direction
+   LISTDIR. */
 int
-history_search (const char *string, int direction)
+history_search (const char *string, int listdir)
 {
-  return (history_search_internal (string, direction, NON_ANCHORED_SEARCH));
+  return (history_search_internal (string, listdir, listdir, NON_ANCHORED_SEARCH));
 }
 
-/* Do an anchored search for string through the history in DIRECTION. */
+/* Do an anchored search for string through the history list in direction
+   LISTDIR. */
 int
-history_search_prefix (const char *string, int direction)
+history_search_prefix (const char *string, int listdir)
 {
-  return (history_search_internal (string, direction, ANCHORED_SEARCH));
+  return (history_search_internal (string, listdir, listdir, ANCHORED_SEARCH));
 }
 
-/* At some point, make this public for users of the history library. */
+/* Perform a history search for STRING, letting the caller specify the flags.
+   At some point, make this public for users of the history library. */
 int
-_hs_history_search (const char *string, int direction, int flags)
+_hs_history_search (const char *string, int listdir, int linedir, int flags)
 {
-  return (history_search_internal (string, direction, flags));
+  return (history_search_internal (string, listdir, linedir, flags));
 }
 
-/* Search for STRING in the history list.  DIR is < 0 for searching
-   backwards.  POS is an absolute index into the history list at
-   which point to begin searching. */
+/* Search for STRING in the history list.  LISTDIR is < 0 for searching
+   backwards through the list.  POS is an absolute index into the history
+   list where the search should begin. */
 int
-history_search_pos (const char *string, int dir, int pos)
+history_search_pos (const char *string, int listdir, int pos)
 {
   int ret, old;
 
   old = where_history ();
   history_set_pos (pos);
-  if (history_search (string, dir) == -1)
+  if (history_search (string, listdir) == -1)
     {
       history_set_pos (old);
       return (-1);
index 8ee47f033096c65b3351016f428471a100ecfe12..5243fd7b2b12ac28ba6f59908206b38dafa2d228 100644 (file)
--- a/mbutil.c
+++ b/mbutil.c
@@ -147,6 +147,61 @@ _rl_utf8_mblen (const char *s, size_t n)
   return -1;
 }
 
+static size_t
+_rl_utf8_mbstrlen (const char *s)
+{
+  size_t clen, nc;
+  int mb_cur_max;
+
+  nc = 0;
+  mb_cur_max = MB_CUR_MAX;
+  while (*s && (clen = (size_t)_rl_utf8_mblen(s, mb_cur_max)) != 0)
+    {
+      if (MB_INVALIDCH (clen))
+       clen = 1;
+      s += clen;
+      nc++;
+    }
+  return nc;
+}
+
+static size_t
+_rl_gen_mbstrlen (const char *s)
+{
+  size_t clen, nc;
+  mbstate_t mbs = { 0 }, mbsbak = { 0 };
+  int f, mb_cur_max;
+
+  nc = 0;
+  mb_cur_max = MB_CUR_MAX;
+  while (*s && (clen = (f = _rl_is_basic (*s)) ? 1 : mbrlen(s, mb_cur_max, &mbs)) != 0)
+    {
+      if (MB_INVALIDCH(clen))
+       {
+         clen = 1;     /* assume single byte */
+         mbs = mbsbak;
+       }
+
+      if (f == 0)
+       mbsbak = mbs;
+
+      s += clen;
+      nc++;
+    }
+  return nc;
+}
+
+size_t
+_rl_mbstrlen (const char *s)
+{
+  if (MB_CUR_MAX == 1)
+    return (strlen (s));
+  else if (_rl_utf8locale)
+    return (_rl_utf8_mbstrlen (s));
+  else
+    return (_rl_gen_mbstrlen (s));
+}
+
 static int
 _rl_find_next_mbchar_internal (const char *string, int seed, int count, int find_non_zero)
 {
@@ -567,7 +622,7 @@ _rl_mb_strcaseeqn (const char *s1, size_t l1, const char *s2, size_t l2, size_t
       s2 += v1;
       n -= v1;
       if ((flags & 1) && (wc1 == L'-' || wc1 == L'_') && (wc2 == L'-' || wc2 == L'_'))
-        continue;
+       continue;
       if (wc1 != wc2)
        return 0;
     }
index 979090979f1c207a028197362a2ad5b9f7c8115e..c58328a90faad94eb863eb9605d482fc3f5517d2 100644 (file)
@@ -543,7 +543,11 @@ _rl_internal_char_cleanup (void)
     rl_vi_check ();
 #endif /* VI_MODE */
 
+#if defined (HANDLE_MULTIBYTE)
+  if (rl_num_chars_to_read && _rl_mbstrlen (rl_line_buffer) >= rl_num_chars_to_read)
+#else
   if (rl_num_chars_to_read && rl_end >= rl_num_chars_to_read)
+#endif
     {
       (*rl_redisplay_function) ();
       _rl_want_redisplay = 0;
index 9aa617031ad1429b03cbbbd46fc2f2566488304c..9eefa889c51b6ce2cff399e6950f43df61ba6abe 100644 (file)
@@ -109,6 +109,8 @@ extern int _rl_find_next_mbchar (const char *, int, int, int);
 
 #ifdef HANDLE_MULTIBYTE
 
+extern size_t _rl_mbstrlen (const char *);
+
 extern int _rl_compare_chars (const char *, int, mbstate_t *, const char *, int, mbstate_t *);
 extern int _rl_get_char_len (const char *, mbstate_t *);
 extern int _rl_adjust_point (const char *, int, mbstate_t *);
@@ -232,4 +234,102 @@ _rl_wcwidth (WCHAR_T wc)
 
 extern int rl_byte_oriented;
 
+/* Snagged from gnulib */
+#ifdef HANDLE_MULTIBYTE
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* is_basic(c) tests whether the single-byte character c is
+   - in the ISO C "basic character set" or is one of '@', '$', and '`'
+     which ISO C 23 ยง 5.2.1.1.(1) guarantees to be single-byte and in
+     practice are safe to treat as basic in the execution character set,
+     or
+   - in the POSIX "portable character set", which
+     <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap06.html>
+     equally guarantees to be single-byte. */
+
+#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
+    && ('$' == 36) && ('%' == 37) && ('&' == 38) && ('\'' == 39) \
+    && ('(' == 40) && (')' == 41) && ('*' == 42) && ('+' == 43) \
+    && (',' == 44) && ('-' == 45) && ('.' == 46) && ('/' == 47) \
+    && ('0' == 48) && ('1' == 49) && ('2' == 50) && ('3' == 51) \
+    && ('4' == 52) && ('5' == 53) && ('6' == 54) && ('7' == 55) \
+    && ('8' == 56) && ('9' == 57) && (':' == 58) && (';' == 59) \
+    && ('<' == 60) && ('=' == 61) && ('>' == 62) && ('?' == 63) \
+    && ('@' == 64) && ('A' == 65) && ('B' == 66) && ('C' == 67) \
+    && ('D' == 68) && ('E' == 69) && ('F' == 70) && ('G' == 71) \
+    && ('H' == 72) && ('I' == 73) && ('J' == 74) && ('K' == 75) \
+    && ('L' == 76) && ('M' == 77) && ('N' == 78) && ('O' == 79) \
+    && ('P' == 80) && ('Q' == 81) && ('R' == 82) && ('S' == 83) \
+    && ('T' == 84) && ('U' == 85) && ('V' == 86) && ('W' == 87) \
+    && ('X' == 88) && ('Y' == 89) && ('Z' == 90) && ('[' == 91) \
+    && ('\\' == 92) && (']' == 93) && ('^' == 94) && ('_' == 95) \
+    && ('`' == 96) && ('a' == 97) && ('b' == 98) && ('c' == 99) \
+    && ('d' == 100) && ('e' == 101) && ('f' == 102) && ('g' == 103) \
+    && ('h' == 104) && ('i' == 105) && ('j' == 106) && ('k' == 107) \
+    && ('l' == 108) && ('m' == 109) && ('n' == 110) && ('o' == 111) \
+    && ('p' == 112) && ('q' == 113) && ('r' == 114) && ('s' == 115) \
+    && ('t' == 116) && ('u' == 117) && ('v' == 118) && ('w' == 119) \
+    && ('x' == 120) && ('y' == 121) && ('z' == 122) && ('{' == 123) \
+    && ('|' == 124) && ('}' == 125) && ('~' == 126)
+/* The character set is ISO-646, not EBCDIC. */
+# define IS_BASIC_ASCII 1
+
+/* All locale encodings (see localcharset.h) map the characters 0x00..0x7F
+   to U+0000..U+007F, like ASCII, except for
+     CP864      different mapping of '%'
+     SHIFT_JIS  different mappings of 0x5C, 0x7E
+     JOHAB      different mapping of 0x5C
+   However, these characters in the range 0x20..0x7E are in the ISO C
+   "basic character set" and in the POSIX "portable character set", which
+   ISO C and POSIX guarantee to be single-byte.  Thus, locales with these
+   encodings are not POSIX compliant.  And they are most likely not in use
+   any more (as of 2023).  */
+# define _rl_is_basic(c) ((unsigned char) (c) < 0x80)
+
+#else
+
+static inline int
+_rl_is_basic (char c)
+{
+  switch (c)
+    {
+    case '\0':
+    case '\007': case '\010':
+    case '\t': case '\n': case '\v': case '\f': case '\r':
+    case ' ': case '!': case '"': case '#': case '$': case '%':
+    case '&': case '\'': case '(': case ')': case '*':
+    case '+': case ',': case '-': case '.': case '/':
+    case '0': case '1': case '2': case '3': case '4':
+    case '5': case '6': case '7': case '8': case '9':
+    case ':': case ';': case '<': case '=': case '>':
+    case '?': case '@':
+    case 'A': case 'B': case 'C': case 'D': case 'E':
+    case 'F': case 'G': case 'H': case 'I': case 'J':
+    case 'K': case 'L': case 'M': case 'N': case 'O':
+    case 'P': case 'Q': case 'R': case 'S': case 'T':
+    case 'U': case 'V': case 'W': case 'X': case 'Y':
+    case 'Z':
+    case '[': case '\\': case ']': case '^': case '_': case '`':
+    case 'a': case 'b': case 'c': case 'd': case 'e':
+    case 'f': case 'g': case 'h': case 'i': case 'j':
+    case 'k': case 'l': case 'm': case 'n': case 'o':
+    case 'p': case 'q': case 'r': case 's': case 't':
+    case 'u': case 'v': case 'w': case 'x': case 'y':
+    case 'z': case '{': case '|': case '}': case '~':
+      return 1;
+    default:
+      return 0;
+    }
+}
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* HANDLE_MULTIBYTE */
+
 #endif /* _RL_MBUTIL_H_ */
index 96bb83a5fda242979dcc73779be48b63c7a1d453..d7a441e23a6c438bf77f41d300c00cfbaa97f82b 100644 (file)
--- a/search.c
+++ b/search.c
@@ -174,12 +174,12 @@ noninc_search_from_pos (char *string, int pos, int dir, int flags, int *ncp)
     }
 
   if (flags & SF_PATTERN)
-    ret = _hs_history_patsearch (s, dir, sflags);
+    ret = _hs_history_patsearch (s, dir, dir, sflags);
   else
     {
       if (_rl_search_case_fold)
        sflags |= CASEFOLD_SEARCH;
-      ret = _hs_history_search (s, dir, sflags);
+      ret = _hs_history_search (s, dir, dir, sflags);
     }
   RL_UNSETSTATE(RL_STATE_SEARCH);
 
index 706035e9f415cbafee90512979bdad8959735571..a67f62146d7076b02aeedc806b2f1159598201a0 100644 (file)
--- a/signals.c
+++ b/signals.c
@@ -279,7 +279,7 @@ _rl_handle_signal (int sig)
 #if defined (HAVE_POSIX_SIGNALS)
       /* Unblock any signal(s) blocked above */
       if (block_sig)
-       sigprocmask (SIG_UNBLOCK, &oset, (sigset_t *)NULL);
+       sigprocmask (SIG_UNBLOCK, &set, &oset);
 #endif
 
       /* We don't have to bother unblocking the signal because we are not