After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 687216 - Improve brace autocompletion.
Improve brace autocompletion.
Status: RESOLVED FIXED
Product: anjuta
Classification: Applications
Component: plugins: language-support-c-cpp-java
unspecified
Other All
: Normal normal
: ---
Assigned To: Naba Kumar
Anjuta maintainers
Depends on:
Blocks:
 
 
Reported: 2012-10-30 16:40 UTC by Carl-Anton Ingmarsson
Modified: 2012-10-31 11:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
indentation-c-style: be more picky when completing braces. (2.48 KB, patch)
2012-10-30 16:40 UTC, Carl-Anton Ingmarsson
none Details | Review
sourceview: don't emit change events after doing an undo (1.25 KB, patch)
2012-10-30 16:40 UTC, Carl-Anton Ingmarsson
none Details | Review
indentation-c-style: remove java_indentation() method (5.63 KB, patch)
2012-10-30 16:40 UTC, Carl-Anton Ingmarsson
none Details | Review
indentation-c-style: When removing opening bracket also remove the closing one. (4.39 KB, patch)
2012-10-30 16:40 UTC, Carl-Anton Ingmarsson
none Details | Review

Description Carl-Anton Ingmarsson 2012-10-30 16:40:05 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.
Comment 1 Carl-Anton Ingmarsson 2012-10-30 16:40:08 UTC
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.
Comment 2 Carl-Anton Ingmarsson 2012-10-30 16:40:11 UTC
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.
Comment 3 Carl-Anton Ingmarsson 2012-10-30 16:40:14 UTC
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.
Comment 4 Carl-Anton Ingmarsson 2012-10-30 16:40:17 UTC
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.
Comment 5 Johannes Schmid 2012-10-31 11:13:17 UTC
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.