GNOME Bugzilla – Bug 687216
Improve brace autocompletion.
Last modified: 2012-10-31 11:13:17 UTC
The following patches fixes two things that I think improves the behavior of brace-autocompletion. 1) Only autocomplete braces when the next character is white-space a closing bracket, "," or ";". 2) Remove matching closing bracket, when removing the opening one, if they're next to eachother.
Created attachment 227651 [details] [review] indentation-c-style: be more picky when completing braces. We now look at the next character to see if we should autocomplete or not. The reason for this is that you often want to enclose an already existing expression in brackets. If we then autocomplete you have to remove this extra bracket since it's at the wrong place anyways.
Created attachment 227652 [details] [review] sourceview: don't emit change events after doing an undo This fixes an issue where the indentation plugin would do stuff based on the inserted text from the undo. This would in turn break the expectation that the text will be the same as it were after the undo.
Created attachment 227653 [details] [review] indentation-c-style: remove java_indentation() method It was only calling cpp_indentation() anyway and it caused problems when blocking the signal handler since we always blocked the cpp one. Also rename cpp_indentation() to cpp_java_indentation_char_added() to facilitate adding another function that acts on the IAnjutaEditor::changed signal instead.
Created attachment 227654 [details] [review] indentation-c-style: When removing opening bracket also remove the closing one. ...if the closing one is right next to the opening bracket.
Thanks! Looks good and works appropriately. Not exactly sure why we didn't block the change signal on undo before because I am pretty sure I had try this because of some weird things that sometimes happen on undo.