Kaydet (Commit) ff866415 authored tarafından Enrico Tröger's avatar Enrico Tröger

Improve auto-closing of braces, brackets and quotes (patch by Guillaume de Rorthais, thanks).

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3378 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 9c230d28
......@@ -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:
......
......@@ -1010,16 +1010,20 @@ static void insert_indent_after_line(GeanyEditor *editor, gint line)
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 = "]";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment