Kaydet (Commit) 57f0d45e authored tarafından Enrico Tröger's avatar Enrico Tröger

Improved HTML "<table>" auto completion to use the indentation better.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@723 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 66a68d80
......@@ -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@btinternet.com>
......
......@@ -838,13 +838,30 @@ gboolean sci_cb_handle_xml(ScintillaObject *sci, gchar ch)
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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment