SF.net SVN: geany:[5320] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Mon Oct 25 16:07:16 UTC 2010
Revision: 5320
http://geany.svn.sourceforge.net/geany/?rev=5320&view=rev
Author: ntrel
Date: 2010-10-25 16:07:15 +0000 (Mon, 25 Oct 2010)
Log Message:
-----------
Move HTML automatic <table> tag completion into a 'table' snippet
so the user can decide when to use it (patch by Eugene Arshinov,
thanks).
Modified Paths:
--------------
trunk/ChangeLog
trunk/data/snippets.conf
trunk/src/editor.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-10-22 16:51:32 UTC (rev 5319)
+++ trunk/ChangeLog 2010-10-25 16:07:15 UTC (rev 5320)
@@ -1,3 +1,11 @@
+2010-10-25 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/editor.c, data/snippets.conf:
+ Move HTML automatic <table> tag completion into a 'table' snippet
+ so the user can decide when to use it (patch by Eugene Arshinov,
+ thanks).
+
+
2010-10-22 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/prefs.c:
Modified: trunk/data/snippets.conf
===================================================================
--- trunk/data/snippets.conf 2010-10-22 16:51:32 UTC (rev 5319)
+++ trunk/data/snippets.conf 2010-10-25 16:07:15 UTC (rev 5320)
@@ -71,3 +71,6 @@
[Haskell]
# prevent completion of "do"-while-loops in Haskell
do=
+
+[HTML]
+table=<table>\n\t<tr>\n\t\t<td>%cursor%</td>\n\t</tr>\n</table>
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2010-10-22 16:51:32 UTC (rev 5319)
+++ trunk/src/editor.c 2010-10-25 16:07:15 UTC (rev 5320)
@@ -106,7 +106,6 @@
static gboolean is_code_style(gint lexer, gint style);
static gboolean is_string_style(gint lexer, gint style);
static void auto_close_chars(ScintillaObject *sci, gint pos, gchar c);
-static void auto_table(GeanyEditor *editor, gint pos);
static void close_block(GeanyEditor *editor, gint pos);
static void editor_highlight_braces(GeanyEditor *editor, gint cur_pos);
static void read_current_word(GeanyEditor *editor, gint pos, gchar *word, size_t wordlen,
@@ -2600,11 +2599,7 @@
sci_start_undo_action(sci);
sci_replace_sel(sci, to_insert);
if (ch == '>')
- {
sci_set_selection(sci, pos, pos);
- if (utils_str_equal(tag_name, "table"))
- auto_table(editor, pos);
- }
sci_end_undo_action(sci);
g_free(to_insert);
}
@@ -2703,50 +2698,6 @@
}
-static void auto_table(GeanyEditor *editor, gint pos)
-{
- ScintillaObject *sci = editor->sci;
- gchar *table;
- gint indent_pos;
- const gchar *indent_str;
-
- if (sci_get_lexer(sci) != SCLEX_HTML) return;
-
- read_indent(editor, pos);
- 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;
- guint x;
-
- x = strlen(indent);
- /* find the start of the <table tag */
- i = 1;
- while (i <= pos && sci_get_char_at(sci, pos - i) != '<') i++;
- /* add all non whitespace before the tag to the indent string */
- while ((pos - i) != indent_pos && x < sizeof(indent) - 1)
- {
- indent[x++] = ' ';
- i++;
- }
- indent[x] = '\0';
- }
-
- if (! editor->auto_indent)
- indent_str = "";
- else
- indent_str = "\t";
-
- table = g_strconcat("\n", indent_str, "<tr>\n",
- indent_str, indent_str, "<td> </td>\n",
- indent_str, "</tr>\n",
- NULL);
- editor_insert_text_block(editor, table, pos, -1,
- count_indent_size(editor, indent), TRUE);
- g_free(table);
-}
-
-
static void real_comment_multiline(GeanyEditor *editor, gint line_start, gint last_line)
{
const gchar *eol;
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