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 768459 - indenter-c: Allow multi-line conditions to end a line with ')'
indenter-c: Allow multi-line conditions to end a line with ')'
Status: RESOLVED FIXED
Product: gnome-builder
Classification: Other
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: GNOME Builder Maintainers
GNOME Builder Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-07-05 18:58 UTC by Matthew Leeds
Modified: 2016-07-06 02:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
indenter-c: Allow multi-line conditions to end a line with ')' (1.64 KB, patch)
2016-07-05 18:58 UTC, Matthew Leeds
reviewed Details | Review

Description Matthew Leeds 2016-07-05 18:58:01 UTC
See commit message.
Comment 1 Matthew Leeds 2016-07-05 18:58:04 UTC
Created attachment 330918 [details] [review]
indenter-c: Allow multi-line conditions to end a line with ')'

Currently the indenter assumes that a condition is complete if one of
its lines ends with a matched ')'. If for some reason you want to end a
line with ')' but not end the condition, the auto indenting would be
wrong. This commit fixes that by checking for an unmatched '(' when a
line ends with ')'.
Comment 2 Christian Hergert 2016-07-05 20:24:03 UTC
Review of attachment 330918 [details] [review]:

Seems fine, just a quick nit.

Rewriting indenters is still on my list for 3.22 (after we get a few other things in place). So while fixes to the indenter are useful, they may be somewhat short lived.

Feel free to commit with the nit fixed.

::: plugins/c-pack/ide-c-indenter.c
@@ -644,2 +641,2 @@
    */
-  if ((ch != ')') && backward_find_matching_char (iter, ')'))
+  GtkTextIter copy = *iter;

Declarations always belong at the top of a scope/block/etc for the Builder code-base.
Comment 3 Matthew Leeds 2016-07-06 02:55:48 UTC
Pushed as commit c80d3d726937b730da920964d871a427976486f2