SF.net SVN: geany: [1539] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Wed May 16 12:51:29 UTC 2007


Revision: 1539
          http://svn.sourceforge.net/geany/?rev=1539&view=rev
Author:   ntrel
Date:     2007-05-16 05:51:29 -0700 (Wed, 16 May 2007)

Log Message:
-----------
Add workaround for PHP/TCL closing brace de-indenting.

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-05-16 12:26:53 UTC (rev 1538)
+++ trunk/ChangeLog	2007-05-16 12:51:29 UTC (rev 1539)
@@ -2,6 +2,8 @@
 
  * src/highlighting.c:
    Fix bug when loading custom filetypes.common styles.
+ * src/sci_cb.c:
+   Add workaround for PHP/TCL closing brace de-indenting.
 
 
 2007-05-15  Nick Treleaven  <nick.treleaven at btinternet.com>

Modified: trunk/src/sci_cb.c
===================================================================
--- trunk/src/sci_cb.c	2007-05-16 12:26:53 UTC (rev 1538)
+++ trunk/src/sci_cb.c	2007-05-16 12:51:29 UTC (rev 1539)
@@ -543,6 +543,7 @@
 }
 
 
+/* Called after typing '}', if pref_editor_indention_mode is INDENT_ADVANCED. */
 void sci_cb_close_block(gint idx, gint pos)
 {
 	gint x = 0, cnt = 0;
@@ -588,6 +589,19 @@
 		SSM(sci, SCI_REPLACESEL, 0, (sptr_t) text);
 		g_free(text);
 	}
+	else
+	if (sci_get_lexer(sci) == SCLEX_HTML || sci_get_lexer(sci) == SCLEX_TCL)
+	{	/* For TCL & PHP brace_match doesn't work here (maybe lexer bugs?),
+		 * so this is a simple workaround. */
+		gint indent = sci_get_line_indentation(sci, line);
+		gint last_indent = sci_get_line_indentation(sci, line - 1);
+
+		if (indent < last_indent)
+			return;
+		indent -= app->pref_editor_tab_width;
+		indent = MAX(0, indent);
+		sci_set_line_indentation(sci, line, indent);
+	}
 }
 
 


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