summaryrefslogtreecommitdiffstats
path: root/contrib/texinfo/info/echo-area.c
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2002-03-25 13:08:32 +0000
committerru <ru@FreeBSD.org>2002-03-25 13:08:32 +0000
commit5500b59c459afe212e4ee8d1c1847e051a9b7653 (patch)
treea83aebd48e0338a00136e68cbd70a1ef081175fc /contrib/texinfo/info/echo-area.c
parent05f7b4b96773cc26ff78d5e68babd66861aa07a8 (diff)
downloadFreeBSD-src-5500b59c459afe212e4ee8d1c1847e051a9b7653.zip
FreeBSD-src-5500b59c459afe212e4ee8d1c1847e051a9b7653.tar.gz
Import of stripped down GNU texinfo 4.1
Diffstat (limited to 'contrib/texinfo/info/echo-area.c')
-rw-r--r--contrib/texinfo/info/echo-area.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/contrib/texinfo/info/echo-area.c b/contrib/texinfo/info/echo-area.c
index 7500523..078e8e7 100644
--- a/contrib/texinfo/info/echo-area.c
+++ b/contrib/texinfo/info/echo-area.c
@@ -1,7 +1,7 @@
/* echo-area.c -- how to read a line in the echo area.
- $Id: echo-area.c,v 1.12 1999/03/03 22:22:14 karl Exp $
+ $Id: echo-area.c,v 1.15 2001/12/12 16:19:39 karl Exp $
- Copyright (C) 1993, 97, 98, 99 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97, 98, 99, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -868,7 +868,10 @@ info_read_completing_internal (window, prompt, completions, force)
/* If no match, go back and try again. */
if (i == completions_found_index)
{
- inform_in_echo_area (_("Not complete"));
+ if (!completions_found_index)
+ inform_in_echo_area (_("No completions"));
+ else
+ inform_in_echo_area (_("Not complete"));
continue;
}
}
@@ -1258,7 +1261,26 @@ build_completions ()
maybe_free (LCD_reference.label);
LCD_reference.label = (char *)xmalloc (1 + shortest);
- strncpy (LCD_reference.label, completions_found[0]->label, shortest);
+ /* Since both the sorting done inside remove_completion_duplicates
+ and all the comparisons above are case-insensitive, it's
+ possible that the completion we are going to return is
+ identical to what the user typed but for the letter-case. This
+ is confusing, since the user could type FOOBAR<TAB> and get her
+ string change letter-case for no good reason. So try to find a
+ possible completion whose letter-case is identical, and if so,
+ use that. */
+ if (completions_found_index > 1)
+ {
+ int req_len = strlen (request);
+
+ for (i = 0; i < completions_found_index; i++)
+ if (strncmp (request, completions_found[i]->label, req_len) == 0)
+ break;
+ /* If none of the candidates match exactly, use the first one. */
+ if (i >= completions_found_index)
+ i = 0;
+ }
+ strncpy (LCD_reference.label, completions_found[i]->label, shortest);
LCD_reference.label[shortest] = '\0';
LCD_completion = &LCD_reference;
}
OpenPOWER on IntegriCloud