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.
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
#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 (" ");
#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;
}
/* 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 ();
/* 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.
#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 */
/* 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
`:' 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
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);
/* 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);
}
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)
{
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 */
}