SF.net SVN: geany:[5392] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Wed Nov 10 17:47:55 UTC 2010


Revision: 5392
          http://geany.svn.sourceforge.net/geany/?rev=5392&view=rev
Author:   ntrel
Date:     2010-11-10 17:47:55 +0000 (Wed, 10 Nov 2010)

Log Message:
-----------
Add xml_indent_tags filetype setting for documents using the
HTML/XML lexers (patch by Eugene Arshinov, thanks).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/data/filetypes.html
    trunk/data/filetypes.xml
    trunk/src/editor.c
    trunk/src/filetypes.c
    trunk/src/filetypesprivate.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-11-10 13:44:10 UTC (rev 5391)
+++ trunk/ChangeLog	2010-11-10 17:47:55 UTC (rev 5392)
@@ -7,6 +7,10 @@
  * src/document.c:
    Fix not reporting an error message when saving a document fails.
    Check result of fclose().
+ * src/filetypesprivate.h, src/filetypes.c, src/editor.c,
+   data/filetypes.xml, data/filetypes.html:
+   Add xml_indent_tags filetype setting for documents using the
+   HTML/XML lexers (patch by Eugene Arshinov, thanks).
 
 
 2010-11-09  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/data/filetypes.html
===================================================================
--- trunk/data/filetypes.html	2010-11-10 13:44:10 UTC (rev 5391)
+++ trunk/data/filetypes.html	2010-11-10 17:47:55 UTC (rev 5392)
@@ -32,6 +32,10 @@
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+# If this setting is set to true, a new line after a line ending with an
+# unclosed tag will be automatically indented
+xml_indent_tags=true
+
 [build_settings]
 # %f will be replaced by the complete filename
 # %e will be replaced by the filename without extension

Modified: trunk/data/filetypes.xml
===================================================================
--- trunk/data/filetypes.xml	2010-11-10 13:44:10 UTC (rev 5391)
+++ trunk/data/filetypes.xml	2010-11-10 17:47:55 UTC (rev 5392)
@@ -103,3 +103,6 @@
 # context action command (please see Geany's main documentation for details)
 context_action_cmd=
 
+# If this setting is set to true, a new line after a line ending with an
+# unclosed tag will be automatically indented
+xml_indent_tags=true
\ No newline at end of file

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2010-11-10 13:44:10 UTC (rev 5391)
+++ trunk/src/editor.c	2010-11-10 17:47:55 UTC (rev 5392)
@@ -55,6 +55,7 @@
 #include "document.h"
 #include "documentprivate.h"
 #include "filetypes.h"
+#include "filetypesprivate.h"
 #include "sciwrappers.h"
 #include "ui_utils.h"
 #include "utils.h"
@@ -1356,8 +1357,9 @@
 		 * recommend us to insert additional indent, we are probably not in PHP/JavaScript chunk and
 		 * should make the XML-related check */
 		if (additional_indent == 0 && !editor_prefs.auto_close_xml_tags &&
-			(editor->document->file_type->id == GEANY_FILETYPES_HTML ||
-			editor->document->file_type->id == GEANY_FILETYPES_XML))
+			(sci_get_lexer(sci) == SCLEX_HTML ||
+			sci_get_lexer(sci) == SCLEX_XML) &&
+			editor->document->file_type->priv->xml_indent_tags)
 		{
 			size += iprefs->width * get_xml_indent(sci, line);
 		}

Modified: trunk/src/filetypes.c
===================================================================
--- trunk/src/filetypes.c	2010-11-10 13:44:10 UTC (rev 5391)
+++ trunk/src/filetypes.c	2010-11-10 17:47:55 UTC (rev 5392)
@@ -1139,6 +1139,8 @@
 
 	ft->priv->symbol_list_sort_mode = utils_get_setting(integer, configh, config, "settings",
 		"symbol_list_sort_mode", SYMBOLS_SORT_BY_NAME);
+	ft->priv->xml_indent_tags = utils_get_setting(boolean, configh, config, "settings",
+		"xml_indent_tags", FALSE);
 
 	/* read build settings */
 	build_load_menu(config, GEANY_BCS_FT, (gpointer)ft);

Modified: trunk/src/filetypesprivate.h
===================================================================
--- trunk/src/filetypesprivate.h	2010-11-10 13:44:10 UTC (rev 5391)
+++ trunk/src/filetypesprivate.h	2010-11-10 17:47:55 UTC (rev 5392)
@@ -43,6 +43,7 @@
 	gchar		*last_string; /* last one compiled */
 	gboolean	custom;
 	gint		symbol_list_sort_mode;
+	gboolean	xml_indent_tags; /* XML tag autoindentation, for HTML and XML filetypes */
 }
 GeanyFiletypePrivate;
 


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