From: Chet Ramey Date: Wed, 10 Jun 2020 15:24:50 +0000 (-0400) Subject: commit readline-20200610 snapshot X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e44dbf91602268c6482127da045262cd6fc3e86;p=thirdparty%2Freadline.git commit readline-20200610 snapshot --- diff --git a/CHANGES b/CHANGES index 2d71360..fc06b49 100644 --- 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. diff --git a/aclocal.m4 b/aclocal.m4 index a962742..a29d26d 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -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 + #endif + #include + ]], + [[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 5366445..e9d5250 100644 --- 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; } diff --git a/readline.c b/readline.c index ed5c428..800eb11 100644 --- a/readline.c +++ b/readline.c @@ -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 9d0f296..d678a31 100644 --- 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 diff --git a/vi_mode.c b/vi_mode.c index 035fb64..a5ec2f8 100644 --- 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 */ }