- 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
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);
/* 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)
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, "e_char);
+#else
+ if (what_to_do == TAB)
+ {
+ if (*matches[0])
+ insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, "e_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, "e_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, "e_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.