On 06/05/11 19:51, Lex Trotman wrote:
Hi All,
As I and others have said in other threads.
In languages like C or C++ lines mostly end in punctuation, so it is unlikely that a line ends in a valid autocomplete, so pressing return to end the line is safe.
In languages like Python lines rarely end in punctuation, so it is likely that a line ends in a valid autocomplete, so pressing return is not safe, you have to check that no autocomplete is present, dismiss it if it is, then press return. Or more likely press return automatically and then go back and edit the inappropriate autocomplete that was added. All very annoying and inefficient.
Soooo annoying.
The attached patch adds a hidden preference to cancel the autocomplete when return is pressed, but before it is processed, removing the problem.
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.
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?
Patch applied & works fine BTW.
Cheers, Matthew Brush