Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Autocomplete little tweak

24 views
Skip to first unread message

Catalin Aramescu

unread,
Apr 2, 2012, 8:42:48 AM4/2/12
to
Hi,

I have this little problem: when I'm doing autocomplete it happens
many times that I press LEFT key instead of DOWN key and I loose the
suggestion box. Then I have to type another character to show the
suggestions again because the box shows only when #charAdded is sent.
Also if I look at Eclipse, for. ex, I see that pressing LEFT/RIGHT key
I can see more/less suggestion depending on the position of the caret
which is a nice feature.

Thanks to the nature of Smalltalk I can fix this myself.
My solution is to add these methods:

SmalltalkWorkspace>>onKeyPressed: aKeyEvent
| code |
code := aKeyEvent code.
code = VK_DELETE | (code = VK_BACK) | (code = VK_LEFT) | (code =
VK_RIGHT)
ifTrue: [self startAutocompleteTimer].
^super onKeyPressed: aKeyEvent

SmalltalkSearchPresenter>>onKeyPressed: aKeyEvent
| code |
code := aKeyEvent code.
code = VK_DELETE | (code = VK_BACK) | (code = VK_LEFT) | (code =
VK_RIGHT)
ifTrue: [self startAutocompleteTimer].
^super onKeyPressed: aKeyEvent

You can see it in action here:
- http://imageshack.us/photo/my-images/856/autocomplete1.png/ (the
caret is before K)
- http://img542.imageshack.us/img542/2151/autocomplete2.png

My first attempt was to add a handler for #charDelete, but it seems
that ScintillaView doesn't publish/support this event.
Is there a better way to make autocomplete behave the way I want it?

Best regards,
Catalin Aramescu

Catalin Aramescu

unread,
Apr 5, 2012, 9:48:25 AM4/5/12
to
Hi,

I changed SmalltalkSearchPresenter>>onKeyPressed: because it creates
problems. The autocomplete pops-up each time I move in the code with
LEFT OR RIGHT key.

SmalltalkSearchPresenter>>onKeyPressed: aKeyEvent
| code |
code := aKeyEvent code.
code = VK_DELETE | (code = VK_BACK) ifTrue: [self
startAutocompleteTimer].
^super onKeyPressed: aKeyEvent

Does anyne Know how I could change the code to show the autocomplete
list on demand, as in Visual Studio when I press CTRL+SPACE?

Thanks,
Catalin Aramescu

0 new messages