]> git.ipfire.org Git - thirdparty/readline.git/commitdiff
commit readline-20200610 snapshot
authorChet Ramey <chet.ramey@case.edu>
Wed, 10 Jun 2020 15:24:50 +0000 (11:24 -0400)
committerChet Ramey <chet.ramey@case.edu>
Wed, 10 Jun 2020 15:24:50 +0000 (11:24 -0400)
CHANGES
aclocal.m4
kill.c
readline.c
tilde.c
vi_mode.c

diff --git a/CHANGES b/CHANGES
index 2d7136094b60ef4d73d015c86a6bfca7c3fd3524..fc06b49f6393aa12bc9ac1148d3204618a8a5c9e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -55,6 +55,13 @@ p. Readline only calls chown(2) on a newly-written history file if it really
 q. Readline now behaves better when operate-and-get-next is used when the
    history list is `full': when there are already $HISTSIZE entries.
 
+r. Fixed a bug that could cause vi redo (`.') of a replace command not to work
+   correctly in the C or POSIX locale.
+
+s. Fixed a bug with vi-mode digit arguments that caused the last command to be
+   set incorrectly. This prevents yank-last-arg from working as intended, for
+   example.
+
 -------------------------------------------------------------------------------
 This document details the changes between this version, readline-8.0, and the
 previous version, readline-7.0.
index a96274291a7d9f15463bab0f91fec38749095423..a29d26deb560c154a41b6127b4f7ec735ee7a81d 100644 (file)
@@ -1179,12 +1179,17 @@ fi
 AC_DEFUN(BASH_STRUCT_TIMEVAL,
 [AC_MSG_CHECKING(for struct timeval in sys/time.h and time.h)
 AC_CACHE_VAL(bash_cv_struct_timeval,
-[
-AC_EGREP_HEADER(struct timeval, sys/time.h,
-               bash_cv_struct_timeval=yes,
-               AC_EGREP_HEADER(struct timeval, time.h,
-                       bash_cv_struct_timeval=yes,
-                       bash_cv_struct_timeval=no))
+[AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+               [[#if HAVE_SYS_TIME_H
+                 #include <sys/time.h>
+                 #endif
+                 #include <time.h>
+               ]],
+               [[static struct timeval x; x.tv_sec = x.tv_usec;]]
+       )],
+       bash_cv_struct_timeval=yes,
+       bash_cv_struct_timeval=no)
 ])
 AC_MSG_RESULT($bash_cv_struct_timeval)
 if test $bash_cv_struct_timeval = yes; then
diff --git a/kill.c b/kill.c
index 5366445e23d85d39f816985a0774be6bdcb1154d..e9d52502a1c21b0b34e5c55f24e78ce55cb7b6da 100644 (file)
--- a/kill.c
+++ b/kill.c
@@ -606,7 +606,7 @@ rl_yank_nth_arg_internal (int count, int key, int history_skip)
 #if defined (VI_MODE)
   /* Vi mode always inserts a space before yanking the argument, and it
      inserts it right *after* rl_point. */
-  if (rl_editing_mode == vi_mode)
+  if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap)
     {
       rl_vi_append_mode (1, key);
       rl_insert_text (" ");
@@ -820,7 +820,10 @@ _rl_bracketed_read_mbstring (char *mb, int mlen)
 #if defined (HANDLE_MULTIBYTE)
   if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
     c = _rl_read_mbstring (c, mb, mlen);
+  else
 #endif
+    mb[0] = c;
+  mb[mlen] = '\0';             /* just in case */
 
   return c;
 }
index ed5c4283aceef338c567e1fca201a0c6e5cc0b34..800eb119cd1488316b7967c065a59eb700f686fa 100644 (file)
@@ -890,7 +890,11 @@ _rl_dispatch_subseq (register int key, Keymap map, int got_subseq)
          /* If we have input pending, then the last command was a prefix
             command.  Don't change the state of rl_last_func.  Otherwise,
             remember the last command executed in this variable. */
+#if defined (VI_MODE)
+         if (rl_pending_input == 0 && map[key].function != rl_digit_argument && map[key].function != rl_vi_arg_digit)
+#else
          if (rl_pending_input == 0 && map[key].function != rl_digit_argument)
+#endif
            rl_last_func = map[key].function;
 
          RL_CHECK_SIGNALS ();
diff --git a/tilde.c b/tilde.c
index 9d0f29614b65f28245a2d170f11a6167dfefad35..d678a31ab2735a95b60906fd979e60cfe63c8056 100644 (file)
--- a/tilde.c
+++ b/tilde.c
@@ -1,6 +1,6 @@
 /* tilde.c -- Tilde expansion code (~/foo := $HOME/foo). */
 
-/* Copyright (C) 1988-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1988-2020 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.
@@ -57,10 +57,10 @@ static void *xmalloc (), *xrealloc ();
 
 #if !defined (HAVE_GETPW_DECLS)
 #  if defined (HAVE_GETPWUID)
-extern struct passwd *getpwuid PARAMS((uid_t));
+extern struct passwd *getpwuid (uid_t);
 #  endif
 #  if defined (HAVE_GETPWNAM)
-extern struct passwd *getpwnam PARAMS((const char *));
+extern struct passwd *getpwnam (const char *);
 #  endif
 #endif /* !HAVE_GETPW_DECLS */
 
@@ -79,8 +79,8 @@ extern struct passwd *getpwnam PARAMS((const char *));
 /* If being compiled as part of bash, these will be satisfied from
    variables.o.  If being compiled as part of readline, they will
    be satisfied from shell.o. */
-extern char *sh_get_home_dir PARAMS((void));
-extern char *sh_get_env_value PARAMS((const char *));
+extern char *sh_get_home_dir (void);
+extern char *sh_get_env_value (const char *);
 
 /* The default value of tilde_additional_prefixes.  This is set to
    whitespace preceding a tilde so that simple programs which do not
@@ -116,10 +116,10 @@ char **tilde_additional_prefixes = (char **)default_prefixes;
    `:' and `=~'. */
 char **tilde_additional_suffixes = (char **)default_suffixes;
 
-static int tilde_find_prefix PARAMS((const char *, int *));
-static int tilde_find_suffix PARAMS((const char *));
-static char *isolate_tilde_prefix PARAMS((const char *, int *));
-static char *glue_prefix_and_suffix PARAMS((char *, const char *, int));
+static int tilde_find_prefix (const char *, int *);
+static int tilde_find_suffix (const char *);
+static char *isolate_tilde_prefix (const char *, int *);
+static char *glue_prefix_and_suffix (char *, const char *, int);
 
 /* Find the start of a tilde expansion in STRING, and return the index of
    the tilde which starts the expansion.  Place the length of the text
index 035fb644ee17e27281f391f6155f363957b33dcc..a5ec2f8bacd458425ccdabf9f6d05a6730bf784d 100644 (file)
--- a/vi_mode.c
+++ b/vi_mode.c
@@ -298,6 +298,11 @@ rl_vi_redo (int count, int c)
       if (rl_point > 0)
        _rl_vi_backup ();
     }
+  else if (_rl_vi_last_command == '.' && _rl_keymap == vi_movement_keymap)
+    {
+      rl_ding ();
+      r = 0;
+    }
   else
     r = _rl_dispatch (_rl_vi_last_command, _rl_keymap);
 
@@ -320,9 +325,9 @@ rl_vi_yank_arg (int count, int key)
   /* Readline thinks that the first word on a line is the 0th, while vi
      thinks the first word on a line is the 1st.  Compensate. */
   if (rl_explicit_arg)
-    rl_yank_nth_arg (count - 1, 0);
+    rl_yank_nth_arg (count - 1, key);
   else
-    rl_yank_nth_arg ('$', 0);
+    rl_yank_nth_arg ('$', key);
 
   return (0);
 }
@@ -2014,10 +2019,11 @@ _rl_vi_callback_change_char (_rl_callback_generic_arg *data)
 
   c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
 #if defined (HANDLE_MULTIBYTE)
-  strncpy (_rl_vi_last_replacement, mb, MB_LEN_MAX);
-#else
-  _rl_vi_last_replacement[0] = c;
+  if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+    strncpy (_rl_vi_last_replacement, mb, MB_LEN_MAX);
+  else
 #endif
+    _rl_vi_last_replacement[0] = c;
   _rl_vi_last_replacement[MB_LEN_MAX] = '\0';  /* XXX */
 
   if (c < 0)
@@ -2054,10 +2060,11 @@ rl_vi_change_char (int count, int key)
     {
       c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
 #ifdef HANDLE_MULTIBYTE
-      strncpy (_rl_vi_last_replacement, mb, MB_LEN_MAX);
-#else
-      _rl_vi_last_replacement[0] = c;
+      if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+       strncpy (_rl_vi_last_replacement, mb, MB_LEN_MAX);
+      else
 #endif
+       _rl_vi_last_replacement[0] = c;
       _rl_vi_last_replacement[MB_LEN_MAX] = '\0';      /* just in case */      
     }