SF.net SVN: geany: [723] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Tue Aug 15 15:53:27 UTC 2006
Revision: 723
Author: eht16
Date: 2006-08-15 08:53:18 -0700 (Tue, 15 Aug 2006)
ViewCVS: http://svn.sourceforge.net/geany/?rev=723&view=rev
Log Message:
-----------
Improved HTML "<table>" auto completion to use the indentation better.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/sci_cb.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-08-15 12:51:36 UTC (rev 722)
+++ trunk/ChangeLog 2006-08-15 15:53:18 UTC (rev 723)
@@ -14,6 +14,8 @@
* src/highlighting.c, data/filetypes.common, doc/geany.docbook:
Use the filetype's default style(SCE_*_DEFAULT) as the main default
style(STYLE_DEFAULT).
+ * src/sci_cb.c: Improved HTML "<table>" auto completion to use the
+ indentation better.
2006-08-14 Nick Treleaven <nick.treleaven at btinternet.com>
Modified: trunk/src/sci_cb.c
===================================================================
--- trunk/src/sci_cb.c 2006-08-15 12:51:36 UTC (rev 722)
+++ trunk/src/sci_cb.c 2006-08-15 15:53:18 UTC (rev 723)
@@ -838,13 +838,30 @@
void sci_cb_auto_table(ScintillaObject *sci, gint pos)
{
gchar *table;
+ gint indent_pos;
if (SSM(sci, SCI_GETLEXER, 0, 0) != SCLEX_HTML) return;
sci_cb_get_indent(sci, pos, TRUE);
- table = g_strconcat("\n", indent, indent, "<tr>\n", indent, indent, indent, "<td>\n",
- indent, indent, indent, "</td>\n", indent, indent, "</tr>\n",
- indent, NULL);
+ indent_pos = sci_get_line_indent_position(sci, sci_get_line_from_position(sci, pos));
+ if ((pos - 7) != indent_pos) // 7 == strlen("<table>")
+ {
+ gint i, x;
+ x = strlen(indent);
+ // find the start of the <table tag
+ i = 1;
+ while (sci_get_char_at(sci, pos - i) != '<') i++;
+ // add all non whitespace before the tag to the indent string
+ while ((pos - i) != indent_pos)
+ {
+ indent[x++] = ' ';
+ i++;
+ }
+ indent[x] = '\0';
+ }
+
+ table = g_strconcat("\n", indent, " <tr>\n", indent, " <td>\n", indent, " </td>\n",
+ indent, " </tr>\n", indent, NULL);
sci_insert_text(sci, pos, table);
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