SF.net SVN: geany:[2800] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Tue Jul 22 13:42:23 UTC 2008


Revision: 2800
          http://geany.svn.sourceforge.net/geany/?rev=2800&view=rev
Author:   eht16
Date:     2008-07-22 13:42:23 +0000 (Tue, 22 Jul 2008)

Log Message:
-----------
Fix space-only indentation when auto-generating HTML tables (patch by Colomban Wendling, thanks, closes #2023160).

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-07-22 13:06:11 UTC (rev 2799)
+++ trunk/ChangeLog	2008-07-22 13:42:23 UTC (rev 2800)
@@ -2,6 +2,9 @@
 
  * scintilla/LexHTML.cxx:
    Backport latest HTML/PHP lexer fixes from Scintilla CVS (#2024387).
+ * src/editor.c:
+   Fix space-only indentation when auto-generating HTML tables
+   (patch by Colomban Wendling, thanks, closes #2023160).
 
 
 2008-07-21  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2008-07-22 13:06:11 UTC (rev 2799)
+++ trunk/src/editor.c	2008-07-22 13:42:23 UTC (rev 2800)
@@ -1791,6 +1791,7 @@
 	ScintillaObject *sci = editor->sci;
 	gchar *table;
 	gint indent_pos;
+	gchar *indent_str;
 
 	if (SSM(sci, SCI_GETLEXER, 0, 0) != SCLEX_HTML) return;
 
@@ -1812,9 +1813,19 @@
 		indent[x] = '\0';
 	}
 
-	table = g_strconcat("\n", indent, "    <tr>\n", indent, "        <td>\n", indent, "        </td>\n",
-						indent, "    </tr>\n", indent, NULL);
+	/* get indent string for generated code */
+	if (editor_prefs.indent_mode == INDENT_NONE)
+		indent_str = g_strdup("");
+	else
+		indent_str = get_whitespace(editor_prefs.tab_width, editor->use_tabs);
+
+	table = g_strconcat("\n", indent, indent_str, "<tr>\n",
+						indent, indent_str, indent_str, "<td>\n",
+						indent, indent_str, indent_str, "</td>\n",
+						indent, indent_str, "</tr>\n",
+						indent, NULL);
 	sci_insert_text(sci, pos, table);
+	g_free(indent_str);
 	g_free(table);
 }
 


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