Little code cleanup in brace_match().

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@971 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2006-11-06 21:02:03 +00:00
parent 84fc71ef56
commit 6de433fe7b
2 changed files with 14 additions and 9 deletions

View File

@ -3,6 +3,7 @@
* data/filetypes.java, src/highlighting.c:
Added Java keywords true and false.
Converted "NULL" to lower case.
* src/sci_cb.c: Little code cleanup in brace_match().
2006-11-05 Enrico Tröger <enrico.troeger@uvena.de>

View File

@ -259,12 +259,14 @@ void on_editor_notification(GtkWidget *editor, gint scn, gpointer lscn, gpointer
}
break;
}
/* case SCN_STYLENEEDED:
#ifdef GEANY_DEBUG
case SCN_STYLENEEDED:
{
geany_debug("style");
break;
}
*/ case SCN_URIDROPPED:
#endif
case SCN_URIDROPPED:
{
if (nt->text != NULL && strlen(nt->text) > 0)
{
@ -386,20 +388,22 @@ static gint brace_match(ScintillaObject *sci, gint pos)
{
gchar chBrace = sci_get_char_at(sci, pos);
gchar chSeek = utils_brace_opposite(chBrace);
gint direction, styBrace, depth = 1;
gchar chAtPos;
gint direction = -1;
gint styBrace;
gint depth = 1;
gint styAtPos;
if (chSeek == '\0') return -1;
styBrace = sci_get_style_at(sci, pos);
direction = -1;
if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<')
if (utils_is_opening_brace(chBrace))
direction = 1;
pos = pos + direction;
while ((pos >= 0) && (pos < sci_get_length(sci)))
{
gchar chAtPos = sci_get_char_at(sci, pos - 1);
gint styAtPos = sci_get_style_at(sci, pos);
chAtPos = sci_get_char_at(sci, pos - 1);
styAtPos = sci_get_style_at(sci, pos);
if ((pos > sci_get_end_styled(sci)) || (styAtPos == styBrace))
{
@ -412,7 +416,7 @@ static gint brace_match(ScintillaObject *sci, gint pos)
}
pos = pos + direction;
}
return - 1;
return -1;
}