[PyKDE] Trivial improvement in the autocompletion of Eric3

Phil Thompson phil at riverbankcomputing.co.uk
Sat Jun 26 13:42:01 BST 2004


On Saturday 26 June 2004 8:39 pm, Maurizio Colucci wrote:
> On Saturday 26 June 2004 03:30, Phil Thompson wrote:
> > On Saturday 26 June 2004 8:02 pm, Maurizio Colucci wrote:
> > > Hello,
> > >
> > > IMHO, with a small change, eric3 would become much more usable.
> > >
> > > I noticed there is a good autocompletion feature, with a listbox that
> > > pops up; then you move with the arrows. The overall result is similar
> > > to emacs' (M-/) autocompletion feature. The only problem is that the
> > > list is not sorted by distance. So it takes many presses on the down
> > > arrow to reach the correct completion (on average).
> > >
> > > Example:
> > > imagine the contents of the file is as follows:
> > >
> > > hbbbbbbb
> > > hddddddd
> > > h                       <<< we press "h" here
> > > hccccccccc
> > > haaaaaaaaa
> > >
> > > and suppose we press h in the middle of the file. Then, the list of
> > > completions should be sorted as follows:
> > > [ hdddddd, hcccccccc, hbbbbbbb, haaaaaa]
> > >
> > > that is, not by name, but by distance (and if two words have the same
> > > distance, you prefer the one above).
> > >
> > > I think if eric3 could have such a feature, I would prefer it over
> > > emacs for editing my code.
> > >
> > > Thanks for any comment :-)
> >
> > I don't understand why a "near" word is more likely to be the one you
> > want to type than a "distant" word.

I see you didn't respond to this fundamental point ;)

> > I would think people use auto-completion for two reasons...
>
> Thanks Phil. :-)
>
> However, I must disagree with your reasoning:
> > 1. To save typing, ie. you know the spelling.
>
> Exactly, to save typing.
>
> > In this case you don't use
> > the arrow keys to move through the list. Instead you keep typing the word
>
> But this contradicts the very hypothesis, that I want to save typing! :-)
> The reasoning is unsound...

In one situation...

I need to type 4 characters of an 8 letter word in order to make that word 
current in the list.

...or in another...

I can type 1 character, look at the list (the order of which may be different 
each time it is displayed depending on where I am in the file) and see that I 
only need to hit a cursor key twice to make the word current.

Personally I'm always going to do the first. It's one extra keystroke, but it 
is relatively predictable. If I'm typing the same word many times I will 
quickly get into the habit of typing the 4 characters and selecting the 
current item without even bothering to look at the list.

Even though the second situation is one less keystroke (but maybe more 
depending on the context) it will be much slower because I have to read 
through the list - particulary if the list might need to be scrolled up or 
down to find what I'm looking for.

Phil




More information about the PyQt mailing list