[Pharo-project] Making cr to autocomplete as well as tab (in Pharo 1.3)

Jimmie Houchin jlhouchin at gmail.com
Fri May 6 04:59:07 CEST 2011

On 5/5/2011 11:00 AM, Tudor Girba wrote:
> Hi,
> This is not great at all. Please read this before going forward.
> We had this in OCompletion before and then it got changed to not use CR for a reason. The problem is when using fluent APIs that are best read when written on multiple lines. For example, suppose that I want to type something like this in Glamour:
> ...
> 	a tree
> 		display: [ ... ]
> After typing "a tree", the first proposed item is "treeLayout" (see the attached picture). If I press enter to go to the next line "tree" is replaced with "treeLayout" and this is not the behavior I want.
> The problem is that CR has a useful meaning when typing a piece of text and this makes it not good as a completion character. Tab on the other hand, is only used in Smalltalk at the beginning of an empty line so there is no danger of overloading its functionality in the middle of a text.
> Now, if you insist, I still believe there is a place for CR. Completion has two modes:
> 1. one in which I write and the completion offers me something, and
> 2. one in which I am after I press the down arrow to select some completion item.
> For 1. you do not want to have CR as a completion character. For 2. it is probably ok because you enter explicitly in a temporary mode and thus you are not typing anymore and this will not induce the conflict.
> Cheers,
> Doru


As I stated in my reply I like the idea of using CR. But you do raise a 
valid point and demonstrate a valid situation.

My question is...
Why isn't OCompletion offering the shortest options first?
If it did so, then your situation wouldn't occur.
tree would be selected before treeLayout.

Is it reasonable to have OCompletion sort the list which is being 
presented alphabetically or alphabetically within the whatever the 
preferred priority is?
ie: alphabetically within a list of the most recently selected items.

It would offer the shortest items first and complete to their end if 
unique, and when you want more you provide more characters or navigate 
to the desired item. Always completing to the first alphabetical unique 
qualified item.

Just a few thoughts that if reasonable and doable could make everybody 



More information about the Pharo-project mailing list