]> git.ipfire.org Git - thirdparty/readline.git/commitdiff
readline-7.0 rc2 distribution readline-7.0-testing readline-7.0-rc2
authorChet Ramey <chet.ramey@case.edu>
Mon, 22 Aug 2016 20:05:57 +0000 (16:05 -0400)
committerChet Ramey <chet.ramey@case.edu>
Mon, 22 Aug 2016 20:05:57 +0000 (16:05 -0400)
CHANGES
CHANGES-7.0
bind.c
callback.c
display.c
doc/rltech.texi
doc/version.texi
readline.h
signals.c

diff --git a/CHANGES b/CHANGES
index 4006145f9ef4de97cfd2de4f7176e57a48f94380..129143907926ec629479b9c4cae02a1e65e583f6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -106,6 +106,9 @@ hh.  Fixed an issue that caused completion of git commands to display
 ii.  Fixed several redisplay bugs having to do with multibyte characters and
      invisible characters in prompt strings.
 
+jj. Fixed a bug that caused mode strings to be displayed incorrectly if the prompt was
+    shorter than the mode string.
+
 2.  New Features in Readline
 
 a.  The history truncation code now uses the same error recovery mechansim as
@@ -170,6 +173,13 @@ q.  Fixed a bug with displaying completions when the prefix display length
 r.  The :p history modifier now applies to the entire line, so any expansion
     specifying :p causes the line to be printed instead of expanded.
 
+s.  New application-callable function: rl_pending_signal(): returns the signal
+    number of any signal readline has caught but not yet handled.
+    
+t.  New application-settable variable: rl_persistent_signal_handlers: if set to a
+    non-zero value, readline will enable the readline-6.2 signal handler behavior   
+    in callback mode: handlers are installed when rl_callback_handler_install is
+    called and removed removed when a complete line has been read.
 
 -------------------------------------------------------------------------------
 This document details the changes between this version, readline-6.3, and the
index 561b079528e14ec0aa65bd867673f30121e53c65..36694cb475b173eb8f367e8b3550d73b25cc2a36 100644 (file)
@@ -106,6 +106,9 @@ hh.  Fixed an issue that caused completion of git commands to display
 ii.  Fixed several redisplay bugs having to do with multibyte characters and
      invisible characters in prompt strings.
 
+jj. Fixed a bug that caused mode strings to be displayed incorrectly if the prompt was
+    shorter than the mode string.
+
 2.  New Features in Readline
 
 a.  The history truncation code now uses the same error recovery mechansim as
@@ -169,3 +172,11 @@ q.  Fixed a bug with displaying completions when the prefix display length
 
 r.  The :p history modifier now applies to the entire line, so any expansion
     specifying :p causes the line to be printed instead of expanded.
+
+s.  New application-callable function: rl_pending_signal(): returns the signal
+    number of any signal readline has caught but not yet handled.
+    
+t.  New application-settable variable: rl_persistent_signal_handlers: if set to a
+    non-zero value, readline will enable the readline-6.2 signal handler behavior   
+    in callback mode: handlers are installed when rl_callback_handler_install is
+    called and removed removed when a complete line has been read.
diff --git a/bind.c b/bind.c
index 3dbc1cea968bec0c1086e4c30c36f3f7108ba70e..f1098c48b17ef910b18edea72c4d36926bb362c4 100644 (file)
--- a/bind.c
+++ b/bind.c
@@ -2591,9 +2591,9 @@ _rl_get_string_variable_value (name)
   else if (_rl_stricmp (name, "emacs-mode-string") == 0)
     return (_rl_emacs_mode_str ? _rl_emacs_mode_str : RL_EMACS_MODESTR_DEFAULT);
   else if (_rl_stricmp (name, "vi-cmd-mode-string") == 0)
-    return (_rl_emacs_mode_str ? _rl_emacs_mode_str : RL_VI_CMD_MODESTR_DEFAULT);
+    return (_rl_vi_cmd_mode_str ? _rl_vi_cmd_mode_str : RL_VI_CMD_MODESTR_DEFAULT);
   else if (_rl_stricmp (name, "vi-ins-mode-string") == 0)
-    return (_rl_emacs_mode_str ? _rl_emacs_mode_str : RL_VI_INS_MODESTR_DEFAULT);
+    return (_rl_vi_ins_mode_str ? _rl_vi_ins_mode_str : RL_VI_INS_MODESTR_DEFAULT);
   else
     return (0);
 }
index fafe5a5a1b091fe7b4e75c5ae08657c6d8bb3a98..cc3ce11f19174dd79ea6dc1ad864fdd168665f49 100644 (file)
 _rl_callback_func_t *_rl_callback_func = 0;
 _rl_callback_generic_arg *_rl_callback_data = 0;
 
+/* Applications can set this to non-zero to have readline's signal handlers
+   installed during the entire duration of reading a complete line, as in
+   readline-6.2.  This should be used with care, because it can result in
+   readline receiving signals and not handling them until it's called again
+   via rl_callback_read_char, thereby stealing them from the application.
+   By default, signal handlers are only active while readline is active. */   
+int rl_persistent_signal_handlers = 0;
+
 /* **************************************************************** */
 /*                                                                 */
 /*                     Callback Readline Functions              */
@@ -82,6 +90,11 @@ _rl_callback_newline ()
 
       if (rl_prep_term_function)
        (*rl_prep_term_function) (_rl_meta_flag);
+
+#if defined (HANDLE_SIGNALS)
+      if (rl_persistent_signal_handlers)
+       rl_set_signals ();
+#endif
     }
 
   readline_internal_setup ();
@@ -103,7 +116,8 @@ rl_callback_handler_install (prompt, linefunc)
 #if defined (HANDLE_SIGNALS)
 #define CALLBACK_READ_RETURN() \
   do { \
-    rl_clear_signals (); \
+    if (rl_persistent_signal_handlers == 0) \
+      rl_clear_signals (); \
     return; \
   } while (0)
 #else
@@ -140,7 +154,8 @@ rl_callback_read_char ()
 
 #if defined (HANDLE_SIGNALS)
   /* Install signal handlers only when readline has control. */
-  rl_set_signals ();
+  if (rl_persistent_signal_handlers == 0)
+    rl_set_signals ();
 #endif
 
   do
index cd9b89f3187c8ea150dc52ee80f36a7965095732..41fb05312eb9fb8c16ac410d8e7871c3f12afec7 100644 (file)
--- a/display.c
+++ b/display.c
@@ -119,6 +119,8 @@ static int _rl_col_width PARAMS((const char *, int, int, int));
    buffer index in others.  This macro is used when deciding whether the
    current cursor position is in the middle of a prompt string containing
    invisible characters.  XXX - might need to take `modmark' into account. */
+/* XXX - only valid when tested against _rl_last_c_pos; buffer indices need
+   to use prompt_last_invisible directly. */
 #define PROMPT_ENDING_INDEX \
   ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) ? prompt_physical_chars : prompt_last_invisible+1)
   
@@ -1674,10 +1676,10 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
   if (lendiff > nmax)
     lendiff = nmax;
   od = ofd - old;      /* index of first difference in visible line */
-  nd = nfd - new;
+  nd = nfd - new;      /* nd, od are buffer indexes */
   if (current_line == 0 && !_rl_horizontal_scroll_mode &&
       _rl_term_cr && lendiff > prompt_visible_length && _rl_last_c_pos > 0 &&
-      (((od > 0 || nd > 0) && (od < PROMPT_ENDING_INDEX || nd < PROMPT_ENDING_INDEX)) ||
+      (((od > 0 || nd > 0) && (od <= prompt_last_invisible || nd <= prompt_last_invisible)) ||
                ((od >= lendiff) && _rl_last_c_pos < PROMPT_ENDING_INDEX)))
     {
 #if defined (__MSDOS__)
@@ -1702,7 +1704,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
         was within the prompt, see if we need to recompute where the lines
         differ.  Check whether where we are now is past the last place where
         the old and new lines are the same and short-circuit now if we are. */
-      if ((od < PROMPT_ENDING_INDEX || nd < PROMPT_ENDING_INDEX) &&
+      if ((od <= prompt_last_invisible || nd <= prompt_last_invisible) &&
           omax == nmax &&
          lendiff > (ols-old) && lendiff > (nls-new))
        return;
@@ -1714,7 +1716,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
         first difference, but you don't know the number of invisible
         characters in that case.
         This needs a lot of work to be efficient. */
-      if ((od < PROMPT_ENDING_INDEX || nd < PROMPT_ENDING_INDEX))
+      if ((od <= prompt_last_invisible || nd <= prompt_last_invisible))
        {
          nfd = new + lendiff;  /* number of characters we output above */
          nd = lendiff;
index 0902852a6b091c575e2f76a7b86d396ed04e7208..b8ce90f95d5b64bbe10d0272ad4e680ab4016521 100644 (file)
@@ -1531,7 +1531,7 @@ main (int c, char **v)
        @{
          rl_resize_terminal ();
          sigwinch_received = 0;
-       }@
+       @}
       if (r < 0)
        continue;     
 
@@ -1591,6 +1591,22 @@ using the callback interface should be prepared to clean up Readline's
 state if they wish to handle the signal before the line handler completes
 and restores the terminal state.
 
+If an application using the callback interface wishes to have Readline
+install its signal handlers at the time the application calls
+@code{rl_callback_handler_install} and remove them only when a complete
+line of input has been read, it should set the
+@code{rl_persistent_signal_handlers} variable to a non-zero value.
+This allows an application to defer all of the handling of the signals
+Readline catches to Readline.
+Applications should use this variable with care; it can result in Readline
+catching signals and not acting on them (or allowing the application to react
+to them) until the application calls @code{rl_callback_read_char}.  This
+can result in an application becoming less responsive to keyboard signals
+like SIGINT.
+If an application does not want or need to perform any signal handling, or
+does not need to do any processing between calls to @code{rl_callback_read_char},
+setting this variable may be desirable.
+
 Readline provides two variables that allow application writers to
 control whether or not it will catch certain signals and act on them
 when they are received.  It is important that applications change the
@@ -1612,6 +1628,15 @@ Readline will install a signal handler for @code{SIGWINCH}.
 The default value of @code{rl_catch_sigwinch} is 1.
 @end deftypevar
 
+@deftypevar int rl_persistent_signal_handlers
+If an application using the callback interface wishes Readline's signal
+handlers to be installed and active during the set of calls to
+@code{rl_callback_read_char} that constitutes an entire single line,
+it should set this variable to a non-zero value.
+
+The default value of @code{rl_persistent_signal_handlers} is 0.
+@end deftypevar
+
 @deftypevar int rl_change_environment
 If this variable is set to a non-zero value,
 and Readline is handling @code{SIGWINCH}, Readline will modify the
@@ -1627,6 +1652,11 @@ for example),
 Readline provides convenience functions to do the necessary terminal
 and internal state cleanup upon receipt of a signal.
 
+@deftypefun int rl_pending_signal (void)
+Return the signal number of the most recent signal Readline received but
+has not yet handled, or 0 if there is no pending signal.
+@end deftypefun
+
 @deftypefun void rl_cleanup_after_signal (void)
 This function will reset the state of the terminal to what it was before
 @code{readline()} was called, and remove the Readline signal handlers for
index 766864aef1cd24460b8c99b5b8c780b77dbdf9cb..9dc2998ab1390038396c65e0732f105df1cfb18c 100644 (file)
@@ -4,7 +4,7 @@ Copyright (C) 1988-2016 Free Software Foundation, Inc.
 
 @set EDITION 7.0
 @set VERSION 7.0
-@set UPDATED 20 April 2016
-@set UPDATED-MONTH April 2016
+@set UPDATED 16 July 2016
+@set UPDATED-MONTH July 2016
 
-@set LASTCHANGE Wed Apr 20 13:32:48 PDT 2016
+@set LASTCHANGE Sat Jul 16 13:43:15 EDT 2016
index 0bd2e04484aee33daa7484c42a3f129108f987af..924bbfb0f213168ff970fbed612b5ca1e9caafb7 100644 (file)
@@ -442,6 +442,8 @@ extern void rl_cleanup_after_signal PARAMS((void));
 extern void rl_reset_after_signal PARAMS((void));
 extern void rl_free_line_state PARAMS((void));
 
+extern int rl_pending_signal PARAMS((void));
+
 extern void rl_echo_signal_char PARAMS((int)); 
 
 extern int rl_set_paren_blink_timeout PARAMS((int));
@@ -640,7 +642,7 @@ extern rl_compentry_func_t *rl_completion_entry_function;
 
 /* Optional generator for menu completion.  Default is
    rl_completion_entry_function (rl_filename_completion_function). */
- extern rl_compentry_func_t *rl_menu_completion_entry_function;
+extern rl_compentry_func_t *rl_menu_completion_entry_function;
 
 /* If rl_ignore_some_completions_function is non-NULL it is the address
    of a function to call after all of the possible matches have been
@@ -832,6 +834,14 @@ extern int rl_ignore_completion_duplicates;
    completion character will be inserted as any other. */
 extern int rl_inhibit_completion;
 
+/* Applications can set this to non-zero to have readline's signal handlers
+   installed during the entire duration of reading a complete line, as in
+   readline-6.2.  This should be used with care, because it can result in
+   readline receiving signals and not handling them until it's called again
+   via rl_callback_read_char, thereby stealing them from the application.
+   By default, signal handlers are only active while readline is active. */   
+extern int rl_persistent_signal_handlers;
+
 /* Input error; can be returned by (*rl_getc_function) if readline is reading
    a top-level command (RL_ISSTATE (RL_STATE_READCMD)). */
 #define READERR                        (-2)
index 4c542b39f2c3f50552f7d607d677df30d37aa61c..0b8dda4871d90863d87b202cf34a2bd3d3913ae0 100644 (file)
--- a/signals.c
+++ b/signals.c
@@ -1,6 +1,6 @@
 /* signals.c -- signal handling support for readline. */
 
-/* Copyright (C) 1987-2015 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2016 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.      
@@ -585,6 +585,11 @@ rl_free_line_state ()
   _rl_reset_argument ();
 }
 
+int
+rl_pending_signal ()
+{
+  return (_rl_caught_signal);
+}
 #endif  /* HANDLE_SIGNALS */
 
 /* **************************************************************** */