SF.net SVN: geany:[5864] trunk

colombanw at users.sourceforge.net colombanw at xxxxx
Sun Jun 26 21:47:48 UTC 2011


Revision: 5864
          http://geany.svn.sourceforge.net/geany/?rev=5864&view=rev
Author:   colombanw
Date:     2011-06-26 21:47:47 +0000 (Sun, 26 Jun 2011)

Log Message:
-----------
Fix indentation brace matching (closes #3309606)

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/editor.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2011-06-26 21:47:28 UTC (rev 5863)
+++ trunk/ChangeLog	2011-06-26 21:47:47 UTC (rev 5864)
@@ -2,6 +2,8 @@
 
  * src/highlighting.c:
    Recognize C# and Vala raw and verbatim strings as string styles.
+ * src/editor.c:
+   Fix indentation brace matching (closes #3309606).
 
 
 2011-06-26  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2011-06-26 21:47:28 UTC (rev 5863)
+++ trunk/src/editor.c	2011-06-26 21:47:47 UTC (rev 5864)
@@ -1498,15 +1498,19 @@
 	gint depth = 1;
 	gint styAtPos;
 
+	/* Hack: we need the style at @p pos but it isn't computed yet, so force styling
+	 * of this very position */
+	sci_colourise(sci, pos, pos + 1);
+
 	styBrace = sci_get_style_at(sci, pos);
 
 	if (utils_is_opening_brace(chBrace, editor_prefs.brace_match_ltgt))
 		direction = 1;
 
-	pos = pos + direction;
+	pos += direction;
 	while ((pos >= 0) && (pos < sci_get_length(sci)))
 	{
-		chAtPos = sci_get_char_at(sci, pos - 1);
+		chAtPos = sci_get_char_at(sci, pos);
 		styAtPos = sci_get_style_at(sci, pos);
 
 		if ((pos > sci_get_end_styled(sci)) || (styAtPos == styBrace))
@@ -1518,7 +1522,7 @@
 			if (depth == 0)
 				return pos;
 		}
-		pos = pos + direction;
+		pos += direction;
 	}
 	return -1;
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list