]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20100506 snapshot
authorChet Ramey <chet.ramey@case.edu>
Tue, 13 Dec 2011 02:58:26 +0000 (21:58 -0500)
committerChet Ramey <chet.ramey@case.edu>
Tue, 13 Dec 2011 02:58:26 +0000 (21:58 -0500)
CWRU/CWRU.chlog
lib/readline/complete.c

index 5eec6dc3b0d2e973266961ebe6c3905f4744ab7c..07585162eaafe8d4f5697ca637bb5420d1f1b081 100644 (file)
@@ -9800,3 +9800,13 @@ lib/readline/text.c
        - make sure `dir' is in the valid range before searching in
          _rl_char_search_internal.  Range checks in the code depend on it
          being non-zero
+
+                                   5/3
+                                   ---
+lib/readline/complete.c
+       - in rl_complete_internal, if show-all-if-ambiguous or
+         show-all-if-unmodified are set (what_to_do == '!' or '@',
+         respectively), and the common match prefix is shorter than the
+         text being completed, inhibit inserting the match.
+         The guess is that replacing text with a shorter match will not
+         be wanted
index 5e362b1af5deb629a1842c67fae4917ba1c7ff21..9d6de76c945a030196eb39e1fcaefb2d8db280a0 100644 (file)
@@ -1784,6 +1784,9 @@ rl_complete_internal (what_to_do)
   int start, end, delimiter, found_quote, i, nontrivial_lcd;
   char *text, *saved_line_buffer;
   char quote_char;
+#if 1
+  int tlen, mlen;
+#endif
 
   RL_SETSTATE(RL_STATE_COMPLETING);
 
@@ -1811,6 +1814,10 @@ rl_complete_internal (what_to_do)
   /* nontrivial_lcd is set if the common prefix adds something to the word
      being completed. */
   nontrivial_lcd = matches && strcmp (text, matches[0]) != 0;
+#if 1
+  if (what_to_do == '!' || what_to_do == '@')
+    tlen = strlen (text);
+#endif
   free (text);
 
   if (matches == 0)
@@ -1844,8 +1851,25 @@ rl_complete_internal (what_to_do)
     case '!':
     case '@':
       /* Insert the first match with proper quoting. */
+#if 0
       if (*matches[0])
        insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, &quote_char);
+#else
+      if (what_to_do == TAB)
+        {
+          if (*matches[0])
+           insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, &quote_char);
+        }
+      else if (*matches[0] && matches[1] == 0)
+       /* should we perform the check only if there are multiple matches? */
+       insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, &quote_char);
+      else if (*matches[0])    /* what_to_do != TAB && multiple matches */
+       {
+         mlen = *matches[0] ? strlen (matches[0]) : 0;
+         if (mlen >= tlen)
+           insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, &quote_char);
+       }
+#endif
 
       /* If there are more matches, ring the bell to indicate.
         If we are in vi mode, Posix.2 says to not ring the bell.