[PyKDE] Trivial improvement in the autocompletion of Eric3

Maurizio Colucci seguso.forever at tin.it
Sat Jun 26 14:43:01 BST 2004

On Saturday 26 June 2004 04:41, Phil Thompson wrote:
> > > 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 ;)

Phil, I apologize. It is not that I don't want to reply, it is just that I 
considered it very obvious. It is simply something we observe. If I have to 
give you some examples:

1. example where you need a word typed a few lines ABOVE:

   class Widget(QObject):
          def __init__(self, width, height, numberOfLocations, longestPath):
                self.numberOfLocations = numberOfLocations
                self.longestPath = longestPath
                self.width= width
                self.height = height.

Here how many times you use a word immediately after the same word?
I would get mad to type this with eric3. I have no choice than to use emacs.
What I want to do is type THE FIRST LETTER only, then look for the completion 
in the list. And the nearest MUST be the first one.

2. example where you need a word typed a few lines BELOW:
	for o in o2a:
                # HERE:
		addObjectToListWithProperIconAndButton(o, selectedObjects, k) 
	for o in o2b:
		addObjectToListWithProperIconAndButton(o, selectedObjects, k)

def addObjectToListWithProperIconAndButton(o, selectedObjects, k):

Sorry if I didn't reply.

> > > 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. 

You mean, you prefer typing 4 characters than typing one and scanning the 
list? Yes, of course: you developed this habit because, if you typed only one 
character, you would have to scan a list that is too long. But IF the list 
was sorted by distance, I bet you would have developed the opposite habit: 
type one character and scan the list. Because the scan would NOT be long in 
that case.

> 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.

I believe typing one character is much more costly than pressing the down 
arrow to search in the completion list. So I don't agree that you should 
judge based on the number of keystrokes required.

> 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.

The point is: you are not using the list in order to save typing letters. You 
don't mind typing very much.

My way of thinking, instead, is this: if I know I have typed a word very 
recently, I type only the first two letters, then I scan the list until I 
find it.



More information about the PyQt mailing list