]> git.ipfire.org Git - thirdparty/readline.git/commitdiff
commit readline-20190805 snapshot
authorChet Ramey <chet.ramey@case.edu>
Mon, 5 Aug 2019 14:24:27 +0000 (10:24 -0400)
committerChet Ramey <chet.ramey@case.edu>
Mon, 5 Aug 2019 14:24:27 +0000 (10:24 -0400)
18 files changed:
CHANGELOG
aclocal.m4
bind.c
configure
configure.ac
display.c
doc/rltech.texi
doc/rluser.texi
histfile.c
input.c
isearch.c
kill.c
misc.c
rlprivate.h
support/shobj-conf
terminal.c
text.c
vi_mode.c

index c080ecae0185a76b8c8ea287ad80a835176a4fff..cfe97b322253cf42c090d352b5e72c3ec8693a04 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,4 @@
-[Readline-specific changelog.  Descriptions of changes to the source are
+\[Readline-specific changelog.  Descriptions of changes to the source are
  found in the bash changelog.]
 
                                    6/9
@@ -1360,3 +1360,7 @@ readline.pc.in
          to support the recommended `#include <readline/readline.h>'. Report
          and fix from Andrea Bolognani <abologna@redhat.com>
 
+                                  5/13
+                                  ----
+configure.ac
+       - hpux: add -DTGETENT_BROKEN to LOCAL_CFLAGS
index a366597acdd55977757a1943931704f3ff28c553..c42dbf3b67ed9c7fdd2b1f5a420b978001b93cb1 100644 (file)
@@ -10,6 +10,7 @@ AC_DEFUN(BASH_C_LONG_LONG,
   ac_cv_c_long_long=yes
 else
 AC_TRY_RUN([
+#include <stdlib.h>
 int
 main()
 {
@@ -33,6 +34,7 @@ AC_DEFUN(BASH_C_LONG_DOUBLE,
   ac_cv_c_long_double=yes
 else
 AC_TRY_RUN([
+#include <stdlib.h>
 int
 main()
 {
@@ -136,6 +138,7 @@ typedef int (*_bashfunc)(const char *, ...);
 #else
 typedef int (*_bashfunc)();
 #endif
+#include <stdlib.h>
 main()
 {
 _bashfunc pf;
@@ -193,6 +196,7 @@ AC_CACHE_VAL(bash_cv_under_sys_siglist,
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#include <stdlib.h>
 #ifndef UNDER_SYS_SIGLIST_DECLARED
 extern char *_sys_siglist[];
 #endif
@@ -220,6 +224,7 @@ AC_CACHE_VAL(bash_cv_sys_siglist,
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#include <stdlib.h>
 #if !HAVE_DECL_SYS_SIGLIST
 extern char *sys_siglist[];
 #endif
@@ -275,6 +280,7 @@ AC_CACHE_VAL(bash_cv_dup2_broken,
 [AC_TRY_RUN([
 #include <sys/types.h>
 #include <fcntl.h>
+#include <stdlib.h>
 main()
 {
   int fd1, fd2, fl;
@@ -337,6 +343,7 @@ AC_CACHE_VAL(bash_cv_opendir_not_robust,
 #  include <ndir.h>
 # endif
 #endif /* HAVE_DIRENT_H */
+#include <stdlib.h>
 main()
 {
 DIR *dir;
@@ -516,6 +523,7 @@ AC_TRY_RUN([
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/resource.h>
+#include <stdlib.h>
 main()
 {
 #ifdef HAVE_QUAD_T
@@ -585,6 +593,7 @@ AC_CACHE_VAL(bash_cv_getenv_redef,
 #ifdef HAVE_UNISTD_H
 #  include <unistd.h>
 #endif
+#include <stdlib.h>
 #ifndef __STDC__
 #  ifndef const
 #    define const
@@ -788,6 +797,7 @@ AC_CACHE_VAL(bash_cv_func_sigsetjmp,
 #include <sys/types.h>
 #include <signal.h>
 #include <setjmp.h>
+#include <stdlib.h>
 
 main()
 {
@@ -883,6 +893,7 @@ AC_CACHE_VAL(bash_cv_printf_a_format,
 [AC_TRY_RUN([
 #include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
 
 int
 main()
@@ -1243,6 +1254,7 @@ AC_CACHE_VAL(bash_cv_pgrp_pipe,
 #ifdef HAVE_UNISTD_H
 #  include <unistd.h>
 #endif
+#include <stdlib.h>
 main()
 {
 # ifdef GETPGRP_VOID
@@ -1307,6 +1319,7 @@ AC_CACHE_VAL(bash_cv_must_reinstall_sighandlers,
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#include <stdlib.h>
 
 typedef RETSIGTYPE sigfunc();
 
@@ -1420,6 +1433,7 @@ AC_CACHE_VAL(bash_cv_sys_named_pipes,
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#include <stdlib.h>
 
 /* Add more tests in here as appropriate. */
 main()
@@ -1653,6 +1667,7 @@ AC_CACHE_VAL(bash_cv_unusable_rtsigs,
 [AC_TRY_RUN([
 #include <sys/types.h>
 #include <signal.h>
+#include <stdlib.h>
 
 #ifndef NSIG
 #  define NSIG 64
@@ -1836,6 +1851,7 @@ AC_CACHE_VAL(ac_cv_rl_version,
 [AC_TRY_RUN([
 #include <stdio.h>
 #include <readline/readline.h>
+#include <stdlib.h>
 
 extern int rl_gnu_readline_p;
 
@@ -2040,6 +2056,7 @@ AC_DEFUN([BASH_FUNC_SNPRINTF],
     AC_CACHE_CHECK([for standard-conformant snprintf], [bash_cv_func_snprintf],
       [AC_TRY_RUN([
 #include <stdio.h>
+#include <stdlib.h>
 
 main()
 {
diff --git a/bind.c b/bind.c
index 2a1e01270aa569044eb2bd51ed866320b0a8d4b6..b6970df60162feda61d83752908a9c32d7362c4a 100644 (file)
--- a/bind.c
+++ b/bind.c
@@ -361,7 +361,7 @@ int
 rl_generic_bind (int type, const char *keyseq, char *data, Keymap map)
 {
   char *keys;
-  int keys_len, prevkey;
+  int keys_len, prevkey, ic;
   register int i;
   KEYMAP_ENTRY k;
   Keymap prevmap;  
@@ -394,7 +394,6 @@ rl_generic_bind (int type, const char *keyseq, char *data, Keymap map)
   for (i = 0; i < keys_len; i++)
     {
       unsigned char uc = keys[i];
-      int ic;
 
       if (i > 0)
        prevkey = ic;
@@ -545,6 +544,7 @@ rl_translate_keyseq (const char *seq, char *array, int *len)
                {
                  i++;          /* seq[i] == '-' */
                  /* XXX - obey convert-meta setting, convert to key seq  */
+                 /* XXX - doesn't yet handle \M-\C-n if convert-meta is on */
                  if (_rl_convert_meta_chars_to_ascii)
                    {
                      array[l++] = ESC; /* ESC is meta-prefix */
index c9b7adef9bd32d1ca79abb280abd7ef649c5ab5e..b4c84609f94717400fe7a765d6f499816a25d72e 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac for Readline 8.0, version 2.85.
+# From configure.ac for Readline 8.0, version 2.86.
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.69 for readline 8.0.
 #
@@ -6807,6 +6807,7 @@ esac
 
 case "$host_os" in
 isc*)  LOCAL_CFLAGS=-Disc386 ;;
+hpux*) LOCAL_CFLAGS=-DTGETENT_BROKEN ;;
 esac
 
 # shared library configuration section
index b73e37b6702e05b1a7b1ad28616b073c9e34603f..5f56b449351ecd6b0e3a34836efb169588df64ec 100644 (file)
@@ -5,7 +5,7 @@ dnl report bugs to chet@po.cwru.edu
 dnl
 dnl Process this file with autoconf to produce a configure script.
 
-# Copyright (C) 1987-2018 Free Software Foundation, Inc.
+# Copyright (C) 1987-2019 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
@@ -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.0, version 2.85])
+AC_REVISION([for Readline 8.0, version 2.86])
 
 AC_INIT(readline, 8.0, bug-readline@gnu.org)
 
@@ -215,6 +215,7 @@ esac
 
 case "$host_os" in
 isc*)  LOCAL_CFLAGS=-Disc386 ;;
+hpux*) LOCAL_CFLAGS=-DTGETENT_BROKEN ;;
 esac
 
 # shared library configuration section
index 4c6cc00ea4929ff5f799af2171418c67fe5a2a19..51296541714239ac481e5f7b9c85f23628f27b56 100644 (file)
--- a/display.c
+++ b/display.c
@@ -76,6 +76,8 @@ static void redraw_prompt PARAMS((char *));
 
 static char *expand_prompt PARAMS((char *, int, int *, int *, int *, int *));
 
+#define DEFAULT_LINE_BUFFER_SIZE       1024
+
 /* State of visible and invisible lines. */
 struct line_state
   {
@@ -219,7 +221,7 @@ static int msg_bufsiz = 0;
 static int forced_display;
 
 /* Default and initial buffer size.  Can grow. */
-static int line_size = 1024;
+static int line_size = DEFAULT_LINE_BUFFER_SIZE;
 
 /* Variables to keep track of the expanded prompt string, which may
    include invisible characters. */
@@ -574,11 +576,6 @@ rl_expand_prompt (char *prompt)
     {
       /* The prompt spans multiple lines. */
       t = ++p;
-      local_prompt = expand_prompt (p, PMT_MULTILINE,
-                                      &prompt_visible_length,
-                                      &prompt_last_invisible,
-                                      &prompt_invis_chars_first_line,
-                                      &prompt_physical_chars);
       c = *t; *t = '\0';
       /* The portion of the prompt string up to and including the
         final newline is now null-terminated. */
@@ -588,6 +585,12 @@ rl_expand_prompt (char *prompt)
                                                   (int *)NULL,
                                                   (int *)NULL);
       *t = c;
+
+      local_prompt = expand_prompt (p, PMT_MULTILINE,
+                                      &prompt_visible_length,
+                                      &prompt_last_invisible,
+                                      &prompt_invis_chars_first_line,
+                                      &prompt_physical_chars);
       local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
       return (prompt_prefix_length);
     }
@@ -603,6 +606,9 @@ init_line_structures (int minsize)
 {
   register int n;
 
+  if (minsize <= _rl_screenwidth)      /* XXX - for gdb */
+    minsize = _rl_screenwidth + 1;
+
   if (invisible_line == 0)     /* initialize it */
     {
       if (line_size < minsize)
@@ -680,6 +686,9 @@ rl_redisplay (void)
       init_line_structures (0);
       rl_on_new_line ();
     }
+  else if (line_size <= _rl_screenwidth)
+    init_line_structures (_rl_screenwidth + 1);
+    
 
   /* Draw the line into the buffer. */
   cpos_buffer_position = -1;
index 15231392a3eaaab9a91782af9b2e15081da3f771..ff8bd04b39519ccd66a60d9fc4343931d697b278 100644 (file)
@@ -1753,7 +1753,7 @@ Set Readline's idea of the terminal size to @var{rows} rows and
 or equal to 0, Readline's idea of that terminal dimension is unchanged.
 This is intended to tell Readline the physical dimensions of the terminal,
 and is used internally to calculate the maximum number of characters that
-may appear on the screen.
+may appear on a single line and on the screen.
 @end deftypefun
 
 If an application does not want to install a @code{SIGWINCH} handler, but
index 41f1da4646b1204b65879e95ebc5ed734a60a7d4..080090b75023305a0924154f10685da1c63bbc9d 100644 (file)
@@ -1178,11 +1178,11 @@ Move back to the start of the current or previous word.
 Words are composed of letters and digits.
 
 @ifset BashFeatures
-@item shell-forward-word ()
+@item shell-forward-word (M-C-f)
 Move forward to the end of the next word.
 Words are delimited by non-quoted shell metacharacters.
 
-@item shell-backward-word ()
+@item shell-backward-word (M-C-b)
 Move back to the start of the current or previous word.
 Words are delimited by non-quoted shell metacharacters.
 @end ifset
@@ -1432,7 +1432,7 @@ Kill the word behind point.
 Word boundaries are the same as @code{backward-word}.
 
 @ifset BashFeatures
-@item shell-kill-word ()
+@item shell-kill-word (M-C-d)
 Kill from point to the end of the current word, or if between
 words, to the end of the next word.
 Word boundaries are the same as @code{shell-forward-word}.
@@ -1442,6 +1442,14 @@ Kill the word behind point.
 Word boundaries are the same as @code{shell-backward-word}.
 @end ifset
 
+@item shell-transpose-words (M-C-t)
+Drag the word before point past the word after point,
+moving point past that word as well.
+If the insertion point is at the end of the line, this transposes
+the last two words on the line.
+Word boundaries are the same as @code{shell-forward-word} and
+@code{shell-backward-word}.
+
 @item unix-word-rubout (C-w)
 Kill the word behind point, using white space as a word boundary.
 The killed text is saved on the kill-ring.
index aa34fe2db4c7631a093602feaadfb4bbc5750219..dea89729243bd7270f332e4d38399a6acf450950 100644 (file)
@@ -375,9 +375,11 @@ read_history_range (const char *filename, int from, int to)
     }
 
   has_timestamps = HIST_TIMESTAMP_START (buffer);
-  history_multiline_entries += has_timestamps && history_write_timestamps;  
+  history_multiline_entries += has_timestamps && history_write_timestamps;
 
   /* Skip lines until we are at FROM. */
+  if (has_timestamps)
+    last_ts = buffer;
   for (line_start = line_end = buffer; line_end < bufend && current_line < from; line_end++)
     if (*line_end == '\n')
       {
@@ -386,7 +388,18 @@ read_history_range (const char *filename, int from, int to)
           line.  We should check more extensively here... */
        if (HIST_TIMESTAMP_START(p) == 0)
          current_line++;
+       else
+         last_ts = p;
        line_start = p;
+       /* If we are at the last line (current_line == from) but we have
+          timestamps (has_timestamps), then line_start points to the
+          text of the last command, and we need to skip to its end. */
+       if (current_line >= from && has_timestamps)
+         {
+           for (line_end = p; line_end < bufend && *line_end != '\n'; line_end++)
+             ;
+           line_start = (*line_end == '\n') ? line_end + 1 : line_end;
+         }
       }
 
   /* If there are lines left to gobble, then gobble them now. */
diff --git a/input.c b/input.c
index a5573305773d6f3435763d66cda983a35f2b4744..0090e97b8b5979b31484453d2518f700d7b5ab24 100644 (file)
--- a/input.c
+++ b/input.c
@@ -635,9 +635,7 @@ _rl_read_mbchar (char *mbchar, int size)
   mb_len = 0;  
   while (mb_len < size)
     {
-      RL_SETSTATE(RL_STATE_MOREINPUT);
-      c = rl_read_key ();
-      RL_UNSETSTATE(RL_STATE_MOREINPUT);
+      c = (mb_len == 0) ? _rl_bracketed_read_key () : rl_read_key ();
 
       if (c < 0)
        break;
index d6c59041772cdb539db2076c7615328d47bbcc9b..951fce57586bde1e53081859dece99eb639ead62 100644 (file)
--- a/isearch.c
+++ b/isearch.c
@@ -297,6 +297,7 @@ _rl_isearch_fini (_rl_search_cxt *cxt)
   rl_clear_message ();
 }
 
+/* XXX - we could use _rl_bracketed_read_mbstring () here. */
 int
 _rl_search_getchar (_rl_search_cxt *cxt)
 {
diff --git a/kill.c b/kill.c
index cf8ca93243b8b282f70c2f0b3ea7657e34c1b49c..6a2e0c6a59500eaf8a9203cd5abff004497f2e29 100644 (file)
--- a/kill.c
+++ b/kill.c
@@ -1,6 +1,6 @@
 /* kill.c -- kill ring management. */
 
-/* Copyright (C) 1994-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1994-2019 Free Software Foundation, Inc.
 
    This file is part of the GNU Readline Library (Readline), a library
    for reading lines of text with interactive input and history editing.      
@@ -668,8 +668,7 @@ rl_yank_last_arg (int count, int key)
 
 /* Having read the special escape sequence denoting the beginning of a
    `bracketed paste' sequence, read the rest of the pasted input until the
-   closing sequence and insert the pasted text as a single unit without
-   interpretation. */
+   closing sequence and return the pasted text. */
 char *
 _rl_bracketed_text (size_t *lenp)
 {
@@ -715,6 +714,10 @@ _rl_bracketed_text (size_t *lenp)
   return (buf);
 }
 
+/* Having read the special escape sequence denoting the beginning of a
+   `bracketed paste' sequence, read the rest of the pasted input until the
+   closing sequence and insert the pasted text as a single unit without
+   interpretation. */
 int
 rl_bracketed_paste_begin (int count, int key)
 {
@@ -729,6 +732,96 @@ rl_bracketed_paste_begin (int count, int key)
   return (retval);
 }
 
+int
+_rl_read_bracketed_paste_prefix (int c)
+{
+  char pbuf[BRACK_PASTE_SLEN+1], *pbpref;
+  int key, ind, j;
+
+  pbpref = BRACK_PASTE_PREF;           /* XXX - debugging */
+  if (c != pbpref[0])
+    return (0);
+  pbuf[ind = 0] = c;
+  while (ind < BRACK_PASTE_SLEN-1 &&
+        (RL_ISSTATE (RL_STATE_INPUTPENDING|RL_STATE_MACROINPUT) == 0) &&
+         _rl_pushed_input_available () == 0 &&
+         _rl_input_queued (0))
+    {
+      key = rl_read_key ();            /* XXX - for now */
+      if (key < 0)
+       break;
+      pbuf[++ind] = key;
+      if (pbuf[ind] != pbpref[ind])
+        break;
+    }
+
+  if (ind < BRACK_PASTE_SLEN-1)                /* read incomplete sequence */
+    {
+      while (ind >= 0)
+       _rl_unget_char (pbuf[ind--]);
+      return (key < 0 ? key : 0);
+    }
+  return (key < 0 ? key : 1);
+}
+
+/* Get a character from wherever we read input, handling input in bracketed
+   paste mode. If we don't have or use bracketed paste mode, this can be
+   used in place of rl_read_key(). */
+int
+_rl_bracketed_read_key ()
+{
+  int c, r;
+  char *pbuf;
+  size_t pblen;
+
+  RL_SETSTATE(RL_STATE_MOREINPUT);
+  c = rl_read_key ();
+  RL_UNSETSTATE(RL_STATE_MOREINPUT);
+
+  if (c < 0)
+    return -1;
+
+  /* read pasted data with bracketed-paste mode enabled. */
+  if (_rl_enable_bracketed_paste && c == ESC && (r = _rl_read_bracketed_paste_prefix (c)) == 1)
+    {
+      pbuf = _rl_bracketed_text (&pblen);
+      if (pblen == 0)
+       {
+         xfree (pbuf);
+         return 0;             /* XXX */
+       }
+      c = (unsigned char)pbuf[0];
+      if (pblen > 1)
+       {
+         while (--pblen > 0)
+           _rl_unget_char ((unsigned char)pbuf[pblen]);
+       }
+      xfree (pbuf);
+    }
+
+  return c;
+}
+
+/* Get a character from wherever we read input, handling input in bracketed
+   paste mode. If we don't have or use bracketed paste mode, this can be
+   used in place of rl_read_key(). */
+int
+_rl_bracketed_read_mbstring (char *mb, int mlen)
+{
+  int c, r;
+
+  c = _rl_bracketed_read_key ();
+  if (c < 0)
+    return -1;
+
+#if defined (HANDLE_MULTIBYTE)
+  if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+    c = _rl_read_mbstring (c, mb, mlen);
+#endif
+
+  return c;
+}
+
 /* A special paste command for Windows users. */
 #if defined (_WIN32)
 #include <windows.h>
diff --git a/misc.c b/misc.c
index 5e7979312cae622be6afb14abbdb341d31d2e188..e6b42ebf2bc9deb5959c4d2bc6a750bcf63501dd 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -138,9 +138,7 @@ _rl_arg_dispatch (_rl_arg_cxt cxt, int c)
         }
       else
        {
-         RL_SETSTATE(RL_STATE_MOREINPUT);
-         key = rl_read_key ();
-         RL_UNSETSTATE(RL_STATE_MOREINPUT);
+         key = _rl_bracketed_read_key ();
          rl_restore_prompt ();
          rl_clear_message ();
          RL_UNSETSTATE(RL_STATE_NUMERICARG);
@@ -589,6 +587,7 @@ int
 rl_get_previous_history (int count, int key)
 {
   HIST_ENTRY *old_temp, *temp;
+  int had_saved_line;
 
   if (count < 0)
     return (rl_get_next_history (-count, key));
@@ -601,6 +600,7 @@ rl_get_previous_history (int count, int key)
     _rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point;
 
   /* If we don't have a line saved, then save this one. */
+  had_saved_line = _rl_saved_line_for_history != 0;
   rl_maybe_save_line ();
 
   /* If the current line has changed, save the changes. */
@@ -624,7 +624,8 @@ rl_get_previous_history (int count, int key)
 
   if (temp == 0)
     {
-      _rl_free_saved_history_line ();
+      if (had_saved_line == 0)
+        _rl_free_saved_history_line ();
       rl_ding ();
     }
   else
index 38e1dc79bf6fc2fd605bad56156c431662235624..76631d7ab740aaa8793d4a9dd8b13c996bbfd0ee 100644 (file)
@@ -309,7 +309,10 @@ extern int _rl_search_getchar PARAMS((_rl_search_cxt *));
 #define BRACK_PASTE_INIT       "\033[?2004h"
 #define BRACK_PASTE_FINI       "\033[?2004l\r"
 
+extern int _rl_read_bracketed_paste_prefix PARAMS((int));
 extern char *_rl_bracketed_text PARAMS((size_t *));
+extern int _rl_bracketed_read_key PARAMS((void));
+extern int _rl_bracketed_read_mbstring PARAMS((char *, int));
 
 /* macro.c */
 extern void _rl_with_macro_input PARAMS((char *));
index 7920f1b5cb907f84d06450fac158291ebe0f0401..95fa1ae7e2f4c8b97fd88e4ddf99b71fb8ece1bc 100644 (file)
@@ -402,18 +402,15 @@ hpux11*)
        SHLIB_STATUS=unsupported
 
        # If you are using the HP ANSI C compiler, you can uncomment and use
-       # this code (I have not tested it)
-#      SHOBJ_STATUS=supported
-#      SHLIB_STATUS=supported
-#
+       # this code from michael.osipov@siemens.com (I have not tested it)
 #      SHOBJ_CFLAGS='+z'
-#      SHOBJ_LD='ld'
-#      SHOBJ_LDFLAGS='-b +s +h $@'
+#      SHOBJ_LD='$(CC)'
+#      SHOBJ_LDFLAGS='-b -Wl,+s -Wl,+h,$@'
 #
-#      SHLIB_XLDFLAGS='+b $(libdir)'
-#      SHLIB_LIBSUFF='sl'
+#      SHLIB_XLDFLAGS='-Wl,+b,$(libdir)'
+#      SHLIB_LIBSUFF='so'
 #      SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'      
-
+#      SHLIB_LIBS='$(TERMCAP_LIB)'
        ;;
 
 sysv4*-*gcc*)
index e5573897762ee8fc37840354a06ffe863ba2ad7d..fa0043820ad2b513b6072d687dc33422f7d64773 100644 (file)
@@ -483,7 +483,11 @@ _rl_init_terminal_io (const char *terminal_name)
       tgetent_ret = tgetent (term_buffer, term);
     }
 
+#ifdef TGETENT_BROKEN
+  if (tgetent_ret < 0)
+#else
   if (tgetent_ret <= 0)
+#endif
     {
       FREE (term_string_buffer);
       FREE (term_buffer);
diff --git a/text.c b/text.c
index 43aa4d97db1efee26d82cfa92d33d64dae3aff95..ff6ab6884a922724c9e68838f30a91abc8232276 100644 (file)
--- a/text.c
+++ b/text.c
@@ -1,6 +1,6 @@
 /* text.c -- text handling commands for readline. */
 
-/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2019 Free Software Foundation, Inc.
 
    This file is part of the GNU Readline Library (Readline), a library
    for reading lines of text with interactive input and history editing.      
@@ -1722,10 +1722,7 @@ _rl_char_search (int count, int fdir, int bdir)
 {
   int c;
 
-  RL_SETSTATE(RL_STATE_MOREINPUT);
-  c = rl_read_key ();
-  RL_UNSETSTATE(RL_STATE_MOREINPUT);
-
+  c = _rl_bracketed_read_key ();
   if (c < 0)
     return 1;
 
index 836371c95fff755e5bb9fc2faf8998310ef286ae..dd4c3e8c4848f36d0fbd7808da373cec0cdd88cd 100644 (file)
--- a/vi_mode.c
+++ b/vi_mode.c
@@ -1,7 +1,7 @@
 /* vi_mode.c -- A vi emulation mode for Bash.
    Derived from code written by Jeff Sparkes (jsparkes@bnr.ca).  */
 
-/* Copyright (C) 1987-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2019 Free Software Foundation, Inc.
 
    This file is part of the GNU Readline Library (Readline), a library
    for reading lines of text with interactive input and history editing.      
@@ -1316,13 +1316,7 @@ rl_domove_read_callback (_rl_vimotion_cxt *m)
 static int
 rl_vi_domove_getchar (_rl_vimotion_cxt *m)
 {
-  int c;
-
-  RL_SETSTATE(RL_STATE_MOREINPUT);
-  c = rl_read_key ();
-  RL_UNSETSTATE(RL_STATE_MOREINPUT);
-
-  return c;
+  return (_rl_bracketed_read_key ());
 }
 
 #if defined (READLINE_CALLBACKS)
@@ -2000,21 +1994,7 @@ _rl_vi_change_char (int count, int c, char *mb)
 static int
 _rl_vi_callback_getchar (char *mb, int mlen)
 {
-  int c;
-
-  RL_SETSTATE(RL_STATE_MOREINPUT);
-  c = rl_read_key ();
-  RL_UNSETSTATE(RL_STATE_MOREINPUT);
-
-  if (c < 0)
-    return -1;
-
-#if defined (HANDLE_MULTIBYTE)
-  if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
-    c = _rl_read_mbstring (c, mb, mlen);
-#endif
-
-  return c;
+  return (_rl_bracketed_read_mbstring (mb, mlen));
 }
 
 #if defined (READLINE_CALLBACKS)
@@ -2137,6 +2117,34 @@ rl_vi_overstrike_delete (int count, int key)
   return (0);
 }
 
+/* Read bracketed paste mode pasted text and insert it in overwrite mode */
+static int
+rl_vi_overstrike_bracketed_paste (int count, int key)
+{
+  int r;
+  char *pbuf;
+  size_t pblen;
+
+  pbuf = _rl_bracketed_text (&pblen);
+  if (pblen == 0)
+    {
+      xfree (pbuf);
+      return 0;
+    }
+  r = pblen;
+  while (--r >= 0)
+    _rl_unget_char ((unsigned char)pbuf[r]);
+  xfree (pbuf);
+
+  while (_rl_pushed_input_available ())
+    {
+      key = rl_read_key ();
+      r = rl_vi_overstrike (1, key);
+    }
+
+  return r;
+}
+
 int
 rl_vi_replace (int count, int key)
 {
@@ -2179,6 +2187,9 @@ rl_vi_replace (int count, int key)
   _rl_vi_last_key_before_insert = key;
   _rl_keymap = vi_replace_map;
 
+  if (_rl_enable_bracketed_paste)
+    rl_bind_keyseq_if_unbound (BRACK_PASTE_PREF, rl_vi_overstrike_bracketed_paste);
+
   return (0);
 }