[Geany-devel] Annoying autocompletions
Matthew Brush
mbrush at xxxxx
Mon Jun 6 05:50:25 UTC 2011
On 06/05/11 22:03, Lex Trotman wrote:
>> Would it be better to add a configurable keybinding to autocomplete so that
>> you can set it to something besides Return through the UI? We already have
>> "Complete snippet" and "Word part completetion", it seems logical to have a
>> "Complete word" that does a similar action. I guess the "Complete word"
>> binding would need to be renamed to something else, maybe "Toggle completion
>> list" or something.
>
> Hi Matthew,
>
> AFAIK "complete word" is the same basic behavior as return, but one
> happens in our code and one in Scintilla.
You would think, but it seems to just toggle the autocomplete list
(maybe between a few lists).
>
> Its not that Geany defines return as autocomplete, it is the default
> GTK "activate menu item" key that makes Scintilla insert the current
> menu item and I can't find any way of changing it. So the point was
> to remove the "imposed on us unwanted definition that can't be
> changed". And the easiest way was just to cancel the menu before the
> key was processed. Note SCI_AUTOCSETSTOPS seemed to work for anything
> except return :-(
I guess you tried "\n" in SCI_AUTOCSTOPS and checked in wasn't in
SCI_AUTOCSETFILLUPS? I've not played with either, just curious. Might
be worth asking on the scintilla-interest list.
>
>>
>> Alternatively, what about checking to see if the caret is at the last
>> (non-whitespace?) position on the line as well to decide whether Return is
>> going to cancel auto-completion?
>
> The menu already autocancels on a whitespace so thats not needed. And
> if I press return I want to break the line so it now *is* the last
> position :-) Otherwise return behavior is inconsistent and I think
> thats a bad thing (tm).
I meant (pseudo code):
function on_key_pressed()
{
if (key_pressed == Enter &&
caret_position == current_line.length - 1 &&
autocomplete_list_is_showing == True)
{
cancel_autocomplete()
return
}
...
}
Not sure if that would work on not.
Anyway, I've just gotten in the habit of using the space bar to cancel
the list at the end of a line and then pressing Enter. Since I have the
trim trailing whitespace thing on, this works well.
Cheers,
Matthew Brush
More information about the Devel
mailing list