--- /dev/null
+This document details the changes between this version, readline-6.3, and the
+previous version, readline-6.2.
+
+1. Changes to Readline
+
+a. Fixed a bug that did not allow the `dd', `cc', or `yy' vi editing mode
+ commands to work on the entire line.
+
+b. Fixed a bug that caused redisplay problems with prompts longer than 128
+ characters and history searches.
+
+c. Fixed a bug that caused readline to try and run code to modify its idea
+ of the screen size in a signal handler context upon receiving a SIGWINCH.
+
+d. Fixed a bug that caused the `meta' key to be enabled beyond the duration
+ of an individual call top readline().
+
+e. Added a workaround for a wcwidth bug in Mac OS X that caused readline's
+ redisplay to mishandle zero-width combining characters.
+
+f. Fixed a bug that caused readline to `forget' part of a key sequence when
+ a multiple-key sequence caused it to break out of an incremental search.
+
+g. Fixed bugs that caused readline to execute code in a signal handler
+ context if interrupted while reading from the file system during completion.
+
+h. Fixed a bug that caused readline to `forget' part of a key sequence when
+ reading an unbound multi-character key sequence.
+
+i. Fixed a bug that caused Readline's signal handlers to be installed beyond
+ the bounds of a single call to readline().
+
+j. Fixed a bug that caused the `.' command to not redo the most recent `R'
+ command in vi mode.
+
+k. Fixed a bug that caused ignoring case in completion matches to result in
+ readline using the wrong match.
+
+l. Paren matching now works in vi insert mode.
+
+m. Fix menu-completion to make show-all-if-ambiguous and menu-complete-display-prefix
+ work together.
+
+n. Fixed a bug that didn't allow the `cc', `dd', or `yy' commands to be redone
+ in vi editing mode.
+
+o. Fixed a bug that caused the filename comparison code to not compare
+ multibyte characters correctly when using case-sensitive or case-mapping
+ comparisons.
+
+p. Fixed the input reading loop to call the input hook function only when there
+ is no terminal input available.
+
+q. Fixed a bug that caused binding a macro to a multi-character key sequence
+ where the sequence and macro value share a common prefix to not perform
+ the macro replacement.
+
+r. Fixed several redisplay errors with multibyte characters and prompts
+ containing invisible characters when using horizontal scrolling.
+
+s. Fixed a bug that caused redisplay errors when trying to overwrite
+ existing characters using multibyte characters.
+
+t. Fixed a bug in vi mode that caused the arrow keys to set the saved last
+ vi-mode command to the wrong value.
+
+u. Fixed a bug that caused double-quoted strings to be scanned incorrectly
+ when being used as the value of a readline variable assignment.
+
+v. Fixed a bug with vi mode that prevented `.' from repeating a command
+ entered on a previous line (command).
+
+w. Fixed a bug that could cause completion to core dump if it was interrupted
+ by a signal.
+
+2. New Features in Readline
+
+a. Readline is now more responsive to SIGHUP and other fatal signals when
+ reading input from the terminal or performing word completion but no
+ longer attempts to run any not-allowable functions from a signal handler
+ context.
+
+b. There are new bindable commands to search the history for the string of
+ characters between the beginning of the line and the point
+ (history-substring-search-forward, history-substring-search-backward)
+
+c. Readline allows quoted strings as the values of variables when setting
+ them with `set'. As a side effect, trailing spaces and tabs are ignored
+ when setting a string variable's value.
+
+d. The history library creates a backup of the history file when writing it
+ and restores the backup on a write error.
+
+e. New application-settable variable: rl_filename_stat_hook: a function called
+ with a filename before using it in a call to stat(2). Bash uses it to
+ expand shell variables so things like $HOME/Downloads have a slash
+ appended.
+
+f. New bindable function `print-last-kbd-macro', prints the most-recently-
+ defined keyboard macro in a reusable format.
+
+g. New user-settable variable `colored-stats', enables use of colored text
+ to denote file types when displaying possible completions (colored analog
+ of visible-stats).
+
+h. New user-settable variable `keyseq-timout', acts as an inter-character
+ timeout when reading input or incremental search strings.
+
+i. New application-callable function: rl_clear_history. Clears the history list
+ and frees all readline-associated private data.
+
+j. New user-settable variable, show-mode-in-prompt, adds a characters to the
+ beginning of the prompt indicating the current editing mode.
+
+k. New application-settable variable: rl_input_available_hook; function to be
+ called when readline detects there is data available on its input file
+ descriptor.
+
+l. Readline calls an application-set event hook (rl_signal_event_hook) after
+ it gets a signal while reading input (read returns -1/EINTR but readline
+ does not handle the signal immediately) to allow the application to handle
+ or otherwise note it. Not currently called for SIGHUP or SIGTERM.
+
+m. If the user-settable variable `history-size' is set to a value less than
+ 0, the history list size is unlimited.
--- /dev/null
+This document details the changes between this version, readline-7.0, and the
+previous version, readline-6.3.
+
+1. Changes to Readline
+
+a. A bug that caused vi-mode `.' to be unable to redo `c', `d', and `y'
+ commands with modifiers was fixed.
+
+b. Fixed a bug that caused callback mode to dump core when reading a
+ multiple-key sequence (e.g., arrow keys).
+
+c. Fixed a bug that caused the redisplay code to erase some of the line when
+ using horizontal scrolling with incremental search.
+
+d. Readline's input handler now performs signal processing if read(2) is
+ interrupted by SIGALRM or SIGVTALRM.
+
+e. Fixed a problem with revert-all-at-newline freeing freed memory.
+
+f. Clarified the documentation for the history_quotes_inhibit_expansion
+ variable to note that it inhibits scanning for the history comment
+ character and that it only affects double-quoted strings.
+
+g. Fixed an off-by-one error in the prompt printed when performing searches.
+
+h. Use pselect(2), if available, to wait for input before calling read(2), so
+ a SIGWINCH can interrupt it, since it doesn't interrupt read(2).
+
+i. Some memory leaks caused by signals interrupting filename completion have
+ been fixed.
+
+j. Reading EOF twice on a non-empty line causes EOF to be returned, rather
+ than the partial line. This can cause partial lines to be executed on
+ SIGHUP, for example.
+
+k. Fixed a bug concerning deleting multibyte characters from the search
+ string while performing an incremental search.
+
+l. Fixed a bug with tilde expanding directory names in filename completion.
+
+m. Fixed a bug that did not allow binding sequences beginning with a `\'.
+
+n. Fixed a redisplay bug involving incorrect line wrapping when the prompt
+ contains a multibyte character in the last screen column.
+
+o. Fixed a bug that caused history expansion to disregard characters that are
+ documented to delimit a history event specifier without requiring `:'.
+
+p. Fixed a bug that could cause reading past the end of a string when reading
+ the value when binding the set of isearch terminators.
+
+q. Fixed a bug that caused readline commands that depend on knowing which
+ key invoked them to misbehave when dispatching key sequences that are
+ prefixes of other key bindings.
+
+r. Paren matching now works in vi insert mode.
+
+2. New Features in Readline
+
+a. The history truncation code now uses the same error recovery mechansim as
+ the history writing code, and restores the old version of the history file
+ on error. The error recovery mechanism handles symlinked history files.
+
+b. There is a new bindable variable, `enable-bracketed-paste', which enables
+ support for a terminal's bracketed paste mode.
+
+c. The editing mode indicators can now be strings and are user-settable
+ (new `emacs-mode-string', `vi-cmd-mode-string' and `vi-ins-mode-string'
+ variables). Mode strings can contain invisible character sequences.
+ Setting mode strings to null strings restores the defaults.
+
+d. Prompt expansion adds the mode string to the last line of a multi-line
+ prompt (one with embedded newlines).
+
+e. There is a new bindable variable, `colored-completion-prefix', which, if
+ set, causes the common prefix of a set of possible completions to be
+ displayed in color.
+
+f. There is a new bindable command `vi-yank-pop', a vi-mode version of emacs-
+ mode yank-pop.
+
+g. The redisplay code underwent several efficiency improvements for multibyte
+ locales.
+
+h. The insert-char function attempts to batch-insert all pending typeahead
+ that maps to self-insert, as long as it is coming from the terminal.
+
+i. rl_callback_sigcleanup: a new application function that can clean up and
+ unset any state set by readline's callback mode. Intended to be used
+ after a signal.
$(srcdir)/histfile.c $(srcdir)/nls.c $(srcdir)/search.c \
$(srcdir)/shell.c $(srcdir)/savestring.c $(srcdir)/tilde.c \
$(srcdir)/text.c $(srcdir)/misc.c $(srcdir)/compat.c \
- $(srcdir)/mbutil.c $(srcdir)/xfree.c
+ $(srcdir)/mbutil.c
# The header files for this library.
HSOURCES = $(srcdir)/readline.h $(srcdir)/rldefs.h $(srcdir)/chardefs.h \
--- /dev/null
+This is a terse description of the new features added to readline-6.3 since
+the release of readline-6.2.
+
+New Features in Readline
+
+a. Readline is now more responsive to SIGHUP and other fatal signals when
+ reading input from the terminal or performing word completion but no
+ longer attempts to run any not-allowable functions from a signal handler
+ context.
+
+b. There are new bindable commands to search the history for the string of
+ characters between the beginning of the line and the point
+ (history-substring-search-forward, history-substring-search-backward)
+
+c. Readline allows quoted strings as the values of variables when setting
+ them with `set'. As a side effect, trailing spaces and tabs are ignored
+ when setting a string variable's value.
+
+d. The history library creates a backup of the history file when writing it
+ and restores the backup on a write error.
+
+e. New application-settable variable: rl_filename_stat_hook: a function called
+ with a filename before using it in a call to stat(2). Bash uses it to
+ expand shell variables so things like $HOME/Downloads have a slash
+ appended.
+
+f. New bindable function `print-last-kbd-macro', prints the most-recently-
+ defined keyboard macro in a reusable format.
+
+g. New user-settable variable `colored-stats', enables use of colored text
+ to denote file types when displaying possible completions (colored analog
+ of visible-stats).
+
+h. New user-settable variable `keyseq-timout', acts as an inter-character
+ timeout when reading input or incremental search strings.
+
+i. New application-callable function: rl_clear_history. Clears the history list
+ and frees all readline-associated private data.
+
+j. New user-settable variable, show-mode-in-prompt, adds a characters to the
+ beginning of the prompt indicating the current editing mode.
+
+k. New application-settable variable: rl_input_available_hook; function to be
+ called when readline detects there is data available on its input file
+ descriptor.
+
+l. Readline calls an application-set event hook (rl_event_hook) after it gets
+ a signal while reading input (read returns -1/EINTR but readline does not
+ handle the signal immediately) to allow the application to handle or
+ otherwise note it.
+
+m. If the user-settable variable `history-size' is set to a value less than
+ 0, the history list size is unlimited.
+
+n. New application-settable variable: rl_signal_event_hook; function that is
+ called when readline is reading terminal input and read(2) is interrupted
+ by a signal. Currently not called for SIGHUP or SIGTERM.
--- /dev/null
+This is a terse description of the new features added to readline-7.0 since
+the release of readline-6.3.
+
+New Features in Readline
+
+a. The history truncation code now uses the same error recovery mechansim as
+ the history writing code, and restores the old version of the history file
+ on error. The error recovery mechanism handles symlinked history files.
+
+b. There is a new bindable variable, `enable-bracketed-paste', which enables
+ support for a terminal's bracketed paste mode.
+
+c. The editing mode indicators can now be strings and are user-settable
+ (new `emacs-mode-string', `vi-cmd-mode-string' and `vi-ins-mode-string'
+ variables). Mode strings can contain invisible character sequences.
+ Setting mode strings to null strings restores the defaults.
+
+d. Prompt expansion adds the mode string to the last line of a multi-line
+ prompt (one with embedded newlines).
+
+e. There is a new bindable variable, `colored-completion-prefix', which, if
+ set, causes the common prefix of a set of possible completions to be
+ displayed in color.
+
+f. There is a new bindable command `vi-yank-pop', a vi-mode version of emacs-
+ mode yank-pop.
+
+g. The redisplay code underwent several efficiency improvements for multibyte
+ locales.
+
+h. The insert-char function attempts to batch-insert all pending typeahead
+ that maps to self-insert, as long as it is coming from the terminal.
+
+i. rl_callback_sigcleanup: a new application function that can clean up and
+ unset any state set by readline's callback mode. Intended to be used
+ after a signal.
arg_directory
};
-/* Prefix color, currently same as directory */
-#define C_PREFIX C_DIR
+/* Prefix color, currently same as socket */
+#define C_PREFIX C_SOCK
extern void _rl_put_indicator (const struct bin_str *ind);
extern void _rl_set_normal_color (void);
static int _rl_internal_pager PARAMS((int));
static char *printable_part PARAMS((char *));
static int fnwidth PARAMS((const char *));
-static int fnprint PARAMS((const char *, int));
+static int fnprint PARAMS((const char *, int, const char *));
static int print_filename PARAMS((char *, char *, int));
static char **gen_completion_matches PARAMS((char *, int, int, rl_compentry_func_t *, int, int));
completions. The colors used are taken from $LS_COLORS, if set. */
int _rl_colored_stats = 0;
+/* Non-zero means to use a color (currently magenta) to indicate the common
+ prefix of a set of possible word completions. */
int _rl_colored_completion_prefix = 1;
#endif
if (temp == 0 || *temp == '\0')
return (pathname);
+ else if (temp[1] == 0 && temp == pathname)
+ return (pathname);
/* If the basename is NULL, we might have a pathname like '/usr/src/'.
Look for a previous slash and, if one is found, return the portion
following that slash. If there's no previous slash, just return the
#define ELLIPSIS_LEN 3
static int
-fnprint (to_print, prefix_bytes)
+fnprint (to_print, prefix_bytes, real_pathname)
const char *to_print;
int prefix_bytes;
+ const char *real_pathname;
{
int printed_len, w;
const char *s;
printed_len = common_prefix_len = 0;
/* Don't print only the ellipsis if the common prefix is one of the
- possible completions */
- if (to_print[prefix_bytes] == '\0')
+ possible completions. Only cut off prefix_bytes if we're going to be
+ printing the ellipsis, which takes precedence over coloring the
+ completion prefix (see print_filename() below). */
+ if (_rl_completion_prefix_display_length > 0 && to_print[prefix_bytes] == '\0')
prefix_bytes = 0;
+#if defined (COLOR_SUPPORT)
+ if (_rl_colored_stats && (prefix_bytes == 0 || _rl_colored_completion_prefix <= 0))
+ colored_stat_start (real_pathname);
+#endif
+
if (prefix_bytes && _rl_completion_prefix_display_length > 0)
{
char ellipsis;
}
if (common_prefix_len > 0 && (s - to_print) >= common_prefix_len)
{
+#if defined (COLOR_SUPPORT)
/* printed bytes = s - to_print */
/* printed bytes should never be > but check for paranoia's sake */
colored_prefix_end ();
+ if (_rl_colored_stats)
+ colored_stat_start (real_pathname); /* XXX - experiment */
+#endif
common_prefix_len = 0;
}
}
+#if defined (COLOR_SUPPORT)
+ /* XXX - unconditional for now */
+ if (_rl_colored_stats)
+ colored_stat_end ();
+#endif
+
return printed_len;
}
/* Defer printing if we want to prefix with a color indicator */
if (_rl_colored_stats == 0 || rl_filename_completion_desired == 0)
#endif
- printed_len = fnprint (to_print, prefix_bytes);
+ printed_len = fnprint (to_print, prefix_bytes, to_print);
if (rl_filename_completion_desired && (
#if defined (VISIBLE_STATS)
extension_char = '/';
}
+ /* Move colored-stats code inside fnprint() */
#if defined (COLOR_SUPPORT)
if (_rl_colored_stats)
- {
- colored_stat_start (new_full_pathname);
- printed_len = fnprint (to_print, prefix_bytes);
- colored_stat_end ();
- }
+ printed_len = fnprint (to_print, prefix_bytes, new_full_pathname);
#endif
xfree (new_full_pathname);
if (_rl_complete_mark_directories && path_isdir (s))
extension_char = '/';
+ /* Move colored-stats code inside fnprint() */
#if defined (COLOR_SUPPORT)
if (_rl_colored_stats)
- {
- colored_stat_start (s);
- printed_len = fnprint (to_print, prefix_bytes);
- colored_stat_end ();
- }
+ printed_len = fnprint (to_print, prefix_bytes, s);
#endif
-
}
xfree (s);
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <signal.h>
+#include <readline/readline.h>
+
+pthread_t main_thread;
+
+void *start_routine(void* arg)
+{
+ sleep(10);
+ pthread_kill(main_thread, SIGUSR1);
+}
+
+void handler(int sig)
+{
+ puts("Trap signal");
+ (void) sig;
+}
+
+
+int main(int argc, char** argv)
+{
+ char *readline_buffer;
+ pthread_t id;
+ struct sigaction sa;
+ sa.sa_handler = handler;
+ sa.sa_flags = 0;
+
+ sigemptyset(&sa.sa_mask);
+ sigaction(SIGUSR1, &sa, NULL);
+
+
+ rl_catch_signals = 0; /* disable signal handling -- This doesn't work */
+ main_thread = pthread_self();
+ pthread_create(&id, NULL, start_routine, NULL);
+ readline_buffer = readline("Enter some text: ");
+
+ puts("main thread done");
+ return 0;
+}
WHICH >= 0 means to replace that particular history entry's data, as
long as it matches OLD. */
void
-replace_history_data (which, old, new)
+_hs_replace_history_data (which, old, new)
int which;
histdata_t *old, *new;
{
# Do not edit -- exists only for use by patch
-0
+8
#endif
/* Flags word encapsulating the current readline state. */
-int rl_readline_state = RL_STATE_NONE;
+unsigned long rl_readline_state = RL_STATE_NONE;
/* The current offset in the current input line. */
int rl_point;
/* Special case rl_do_lowercase_version (). */
if (func == rl_do_lowercase_version)
/* Should we do anything special if key == ANYOTHERKEY? */
- return (_rl_dispatch (_rl_to_lower (key), map));
+ return (_rl_dispatch (_rl_to_lower ((unsigned char)key), map));
rl_executing_keymap = map;
rl_executing_key = key;
type = m[ANYOTHERKEY].type;
func = m[ANYOTHERKEY].function;
if (type == ISFUNC && func == rl_do_lowercase_version)
- r = _rl_dispatch (_rl_to_lower (key), map);
+ r = _rl_dispatch (_rl_to_lower ((unsigned char)key), map);
else if (type == ISFUNC)
{
/* If we shadowed a function, whatever it is, we somehow need a
extern int rl_gnu_readline_p;
/* Flags word encapsulating the current readline state. */
-extern int rl_readline_state;
+extern unsigned long rl_readline_state;
/* Says which editing mode readline is currently using. 1 means emacs mode;
0 means vi mode. */
$(topdir)/shell.c $(topdir)/savestring.c $(topdir)/tilde.c \
$(topdir)/text.c $(topdir)/misc.c $(topdir)/compat.c \
$(topdir)/colors.c $(topdir)/parse-colors.c \
- $(topdir)/mbutil.c $(topdir)/xfree.c
+ $(topdir)/mbutil.c
# The header files for this library.
HSOURCES = $(topdir)/readline.h $(topdir)/rldefs.h $(topdir)/chardefs.h \
#include "rlprivate.h"
#include "xmalloc.h"
-extern void replace_history_data PARAMS((int, histdata_t *, histdata_t *));
+extern void _hs_replace_history_data PARAMS((int, histdata_t *, histdata_t *));
/* Non-zero tells rl_delete_text and rl_insert_text to not add to
the undo list. */
orig_list = rl_undo_list;
_rl_free_undo_list (rl_undo_list);
rl_undo_list = (UNDO_LIST *)NULL;
- replace_history_data (-1, (histdata_t *)orig_list, (histdata_t *)NULL);
+ _hs_replace_history_data (-1, (histdata_t *)orig_list, (histdata_t *)NULL);
}
UNDO_LIST *
xfree (temp);
}
- replace_history_data (-1, (histdata_t *)release, (histdata_t *)rl_undo_list);
+ _hs_replace_history_data (-1, (histdata_t *)release, (histdata_t *)rl_undo_list);
xfree (release);
}