Revision: 3378 http://geany.svn.sourceforge.net/geany/?rev=3378&view=rev Author: eht16 Date: 2008-12-15 21:19:44 +0000 (Mon, 15 Dec 2008)
Log Message: ----------- Improve auto-closing of braces, brackets and quotes (patch by Guillaume de Rorthais, thanks).
Modified Paths: -------------- trunk/ChangeLog trunk/src/editor.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-12-15 18:13:31 UTC (rev 3377) +++ trunk/ChangeLog 2008-12-15 21:19:44 UTC (rev 3378) @@ -5,6 +5,13 @@ Add stash_group_add_radio_buttons().
+2008-12-14 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + + * src/editor.c: + Improve auto-closing of braces, brackets and quotes + (patch by Guillaume de Rorthais, thanks). + + 2008-12-11 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/plugins.c, src/toolbar.c:
Modified: trunk/src/editor.c =================================================================== --- trunk/src/editor.c 2008-12-15 18:13:31 UTC (rev 3377) +++ trunk/src/editor.c 2008-12-15 21:19:44 UTC (rev 3378) @@ -1010,16 +1010,20 @@ static void auto_close_chars(ScintillaObject *sci, gint pos, gchar c) { const gchar *closing_char = NULL; + gint end_pos = -1;
- if ((editor_prefs.autoclose_chars & GEANY_AC_PARENTHESIS) && c == '(') + if (utils_isbrace(c, 0)) + end_pos = SSM(sci, SCI_BRACEMATCH, pos - 1, 0); + + if ((editor_prefs.autoclose_chars & GEANY_AC_PARENTHESIS) && end_pos == -1 && c == '(') { closing_char = ")"; } - else if ((editor_prefs.autoclose_chars & GEANY_AC_CBRACKET) && c == '{') + else if ((editor_prefs.autoclose_chars & GEANY_AC_CBRACKET) && end_pos == -1 && c == '{') { closing_char = "}"; } - else if ((editor_prefs.autoclose_chars & GEANY_AC_SBRACKET) && c == '[') + else if ((editor_prefs.autoclose_chars & GEANY_AC_SBRACKET) && end_pos == -1 && c == '[') { closing_char = "]"; }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.