From a274363275c5e6530bf588852e42b669067c1811 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Mon, 25 Oct 2010 16:07:15 +0000 Subject: [PATCH] Move HTML automatic tag completion into a 'table' snippet so the user can decide when to use it (patch by Eugene Arshinov, thanks). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5320 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 8 ++++++++ data/snippets.conf | 3 +++ src/editor.c | 49 ---------------------------------------------- 3 files changed, 11 insertions(+), 49 deletions(-) diff --git a/ChangeLog b/ChangeLog index e2845a83..c69609fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-10-25 Nick Treleaven + + * src/editor.c, data/snippets.conf: + Move HTML automatic
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 * src/prefs.c: diff --git a/data/snippets.conf b/data/snippets.conf index 042413a6..317119e8 100644 --- a/data/snippets.conf +++ b/data/snippets.conf @@ -71,3 +71,6 @@ monitor=monitor%block_cursor%handle%block% [Haskell] # prevent completion of "do"-while-loops in Haskell do= + +[HTML] +table=
\n\t\n\t\t\n\t\n
%cursor%
diff --git a/src/editor.c b/src/editor.c index 3e95f0a4..6e76e823 100644 --- a/src/editor.c +++ b/src/editor.c @@ -106,7 +106,6 @@ static void auto_multiline(GeanyEditor *editor, gint pos); 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 @@ static void insert_closing_tag(GeanyEditor *editor, gint pos, gchar ch, const gc 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 gsize count_indent_size(GeanyEditor *editor, const gchar *base_indent) } -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("") */ - { - gint i; - guint x; - - x = strlen(indent); - /* find the start of the
auto_indent) - indent_str = ""; - else - indent_str = "\t"; - - table = g_strconcat("\n", indent_str, "\n", - indent_str, indent_str, "\n", - indent_str, "\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;