[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: index problem
From: |
Eli Zaretskii |
Subject: |
Re: index problem |
Date: |
Sun, 09 Sep 2001 14:34:24 +0300 |
> From: "Eli Zaretskii" <address@hidden>
> Date: Sun, 09 Sep 2001 08:50:42 +0300
>
> > BTW, I think I've found a bug (or at least a bad feature) in info 4.0.
> > Considering groff again, there are two escapes called \a and \A. Now
> > suppose that I want to search index entries for \A: pressing `i', then
> > `\A', and finally <tab>. After entering the tab, `\A' has been
> > converted to `\a'! This is not correct IMHO. If the user is
> > specifically asking for an uppercase letter, info must not convert it
> > back while searching index entries.
>
> I will see what can be done here. From my experience with hacking the
> stand-alone Info, the case-conversion might be very hard to remove
> without rewriting low-level search code. But perhaps this case is an
> exception...
We got lucky ;-) It turned out this is quite easy to fix. Please try
this change:
2001-09-09 Eli Zaretskii <address@hidden>
* info/echo-area.c (build_completions): Look for a candidate
completion which matches user's request including the letter-case,
use that as the value of LCD_completion.
--- info/echo-area.c~1 Sat Jun 2 16:12:10 2001
+++ info/echo-area.c Sun Sep 9 14:00:24 2001
@@ -1261,7 +1261,24 @@ 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. Sp try to find a
+ possible completion whose letter-case is identical, and if so,
+ use that. */
+ if (completions_found_index > 1)
+ {
+ for (i = 0; i < completions_found_index; i++)
+ if (strncmp (request, completions_found[i]->label, shortest) == 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;
}
- index problem, Werner LEMBERG, 2001/09/04
- Re: index problem, Eli Zaretskii, 2001/09/05
- Re: index problem, Werner LEMBERG, 2001/09/05
- Re: index problem, Eli Zaretskii, 2001/09/06
- Re: index problem, Werner LEMBERG, 2001/09/08
- Re: index problem, Eli Zaretskii, 2001/09/09
- Re: index problem,
Eli Zaretskii <=
- Re: index problem, Werner LEMBERG, 2001/09/21
- Re: index problem, Eli Zaretskii, 2001/09/21
- Re: index problem, Werner LEMBERG, 2001/09/23
- Re: index problem, Eli Zaretskii, 2001/09/23
- Re: index problem, Werner LEMBERG, 2001/09/24
- Re: index problem, Eli Zaretskii, 2001/09/24