]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
command completion, key binding fixes
authorChet Ramey <chet.ramey@case.edu>
Mon, 19 Apr 2021 13:40:14 +0000 (09:40 -0400)
committerChet Ramey <chet.ramey@case.edu>
Mon, 19 Apr 2021 13:40:14 +0000 (09:40 -0400)
CWRU/CWRU.chlog
bashline.c
builtins/bind.def
lib/readline/doc/rltech.texi
lib/readline/doc/version.texi

index d7456f6f472f697ab7e5c1d2b464443280523099..e0610f62915abfc340e790058d64b13bcb089281 100644 (file)
@@ -10000,3 +10000,24 @@ variables.c
                                   ----
 doc/{bash.1,bashref.texi}
        - add link to git master tar file as a place to get the current version
+
+                                  4/14
+                                  ----
+bashline.c
+       - attempt_shell_completion: use -1 as a sentinel value for
+         in_command_position indicating that we cannot be in a command position
+         (e.g., because we're the target of a redirection) and should not
+         check for a programmable command completion or tell the programmable
+         completion code to use command completion. Report and fix from
+         Marc Aurèle La France <tsi@tuyoix.net>
+
+                                  4/16
+                                  ----
+builtins/bind.def
+       - bind_builtin: reverse sense of strvec_search return value when
+         deciding whether or not to remove a unix-command binding from the
+         cmd keymap. Bug report by Dale Sedivec <dale@codefu.org>
+
+lib/readline/doc/rltech.texi
+       - RL_PROMPT_{START,END}_IGNORE: document current values of \001 and
+         \002. Report from Mingye Wang <arthur200126@gmail.com>
index 970b297f142de509882208d57efb39c06798ba54..362f0176a5284999098d5903e689bdcce40de863 100644 (file)
@@ -1618,7 +1618,7 @@ attempt_shell_completion (text, start, end)
       in_command_position++;
 
       if (check_redir (ti) == 1)
-       in_command_position = 0;
+       in_command_position = -1;       /* sentinel that we're not the first word on the line */
     }
   else
     {
@@ -1627,7 +1627,7 @@ attempt_shell_completion (text, start, end)
         assignments. */
     }
 
-  if (in_command_position && invalid_completion (text, ti))
+  if (in_command_position > 0 && invalid_completion (text, ti))
     {
       rl_attempted_completion_over = 1;
       return ((char **)NULL);
@@ -1635,9 +1635,9 @@ attempt_shell_completion (text, start, end)
 
   /* Check that we haven't incorrectly flagged a closed command substitution
      as indicating we're in a command position. */
-  if (in_command_position && ti >= 0 && rl_line_buffer[ti] == '`' &&
+  if (in_command_position > 0 && ti >= 0 && rl_line_buffer[ti] == '`' &&
        *text != '`' && unclosed_pair (rl_line_buffer, end, "`") == 0)
-    in_command_position = 0;
+    in_command_position = -1;  /* not following a command separator */
 
   /* Special handling for command substitution.  If *TEXT is a backquote,
      it can be the start or end of an old-style command substitution, or
@@ -1645,8 +1645,8 @@ attempt_shell_completion (text, start, end)
      succeed.  Don't bother if readline found a single quote and we are
      completing on the substring.  */
   if (*text == '`' && rl_completion_quote_character != '\'' &&
-       (in_command_position || (unclosed_pair (rl_line_buffer, start, "`") &&
-                                unclosed_pair (rl_line_buffer, end, "`"))))
+       (in_command_position > 0 || (unclosed_pair (rl_line_buffer, start, "`") &&
+                                    unclosed_pair (rl_line_buffer, end, "`"))))
     matches = rl_completion_matches (text, command_subst_completion_function);
 
 #if defined (PROGRAMMABLE_COMPLETION)
@@ -1654,7 +1654,7 @@ attempt_shell_completion (text, start, end)
   have_progcomps = prog_completion_enabled && (progcomp_size () > 0);
   iw_compspec = progcomp_search (INITIALWORD);
   if (matches == 0 &&
-      (in_command_position == 0 || text[0] == '\0' || (in_command_position && iw_compspec)) &&
+      (in_command_position == 0 || text[0] == '\0' || (in_command_position > 0 && iw_compspec)) &&
       current_prompt_string == ps1_prompt)
     {
       int s, e, s1, e1, os, foundcs;
@@ -1776,7 +1776,7 @@ attempt_shell_completion (text, start, end)
   if (matches == 0)
     {
       dflags = 0;
-      if (in_command_position)
+      if (in_command_position > 0)
        dflags |= DEFCOMP_CMDPOS;
       matches = bash_default_completion (text, start, end, qc, dflags);
     }
index ccfc08dcd7b1b8862d3e1297dfc44d66454e9edb..2eaaafda5b8f2c9a100ae19e2c4a0382982e8f3a 100644 (file)
@@ -290,7 +290,7 @@ bind_builtin (list)
 
       if (nlen < olen) /* fewer bind -x bindings */
        for (d = olen - nlen, i = 0; i < olen && d > 0; i++)
-         if (nlen == 0 || strvec_search (nbindings, obindings[i]) >= 0)
+         if (nlen == 0 || strvec_search (nbindings, obindings[i]) < 0)
            {
              unbind_unix_command (obindings[i]);
              d--;
index a440225668d961f9c4d6961c7ee998e1575f68b6..0baf588ddf078683534967cb43cee3a1710f22fc 100644 (file)
@@ -1072,8 +1072,9 @@ It returns the number of visible characters on the last line of the
 Applications may indicate that the prompt contains characters that take
 up no physical screen space when displayed by bracketing a sequence of
 such characters with the special markers @code{RL_PROMPT_START_IGNORE}
-and @code{RL_PROMPT_END_IGNORE} (declared in @file{readline.h}).  This may
-be used to embed terminal-specific escape sequences in prompts.
+and @code{RL_PROMPT_END_IGNORE} (declared in @file{readline.h} as
+@samp{\001} and @samp{\002}, respectively).
+This may be used to embed terminal-specific escape sequences in prompts.
 @end deftypefun
 
 @deftypefun int rl_set_prompt (const char *prompt)
index 0b565239bb5dfa7c9eb3cfabc1f0d58593eb4c88..e90db4c18f271da9f8cf379f1eb1704ed4d1795e 100644 (file)
@@ -4,7 +4,7 @@ Copyright (C) 1988-2021 Free Software Foundation, Inc.
 
 @set EDITION 8.1
 @set VERSION 8.1
-@set UPDATED 31 March 2021
-@set UPDATED-MONTH March 2021
+@set UPDATED 16 April 2021
+@set UPDATED-MONTH April 2021
 
-@set LASTCHANGE Wed Mar 31 11:45:32 EDT 2021
+@set LASTCHANGE Fri Apr 16 14:51:06 EDT 2021