diff --git a/ChangeLog b/ChangeLog index a8d9ee92..fc878a01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,13 +1,17 @@ 2008-01-12 Enrico Tröger - * src/keyfile.c: Try to fix changing message window height when using - full screen (closes #1869415). + * src/keyfile.c: + Try to fix changing message window height when using full screen + (closes #1869415). * src/printing.c: Avoid double status message if print dialog was cancelled. Print status messages in status-changed handler. * Makefile.am, po/POTFILES.skip: Add POTFILES.skip to ignore files with translatable strings. Make "distcheck" working. + * src/editor.c: + Don't add '>' when auto completing HTML tags when it's already there. + Fix wrong indentation when '{' and '}' are on the same line. 2008-01-11 Nick Treleaven diff --git a/src/editor.c b/src/editor.c index aa0f0bde..b9a86c7c 100644 --- a/src/editor.c +++ b/src/editor.c @@ -510,7 +510,8 @@ static void get_indent(document *doc, gint pos, gboolean use_this_line) prev_line = sci_get_line_from_position(sci, pos); - if (! use_this_line) prev_line--; + if (! use_this_line) + prev_line--; len = sci_get_line_length(sci, prev_line); linebuf = sci_get_line(sci, prev_line); @@ -527,7 +528,9 @@ static void get_indent(document *doc, gint pos, gboolean use_this_line) if (! lexer_has_braces(sci)) break; - if (linebuf[i] == '{') + // i == (len - 1) prevents wrong indentation after lines like + // " { return bless({}, shift); }" (Perl) + if (linebuf[i] == '{' && i == (len - 1)) { do_indent(indent, sizeof(indent), &j, doc->use_tabs); break; @@ -1347,10 +1350,7 @@ static gboolean handle_xml(gint idx, gchar ch) // User typed something like "
" return FALSE; - if (ch == '/') - str_found = utils_find_open_xml_tag(sel, pos - min, TRUE); - else - str_found = utils_find_open_xml_tag(sel, pos - min, FALSE); + str_found = utils_find_open_xml_tag(sel, pos - min, (ch == '/')); // when found string is something like br, img or another short tag, quit if (utils_str_equal(str_found, "br") @@ -1366,11 +1366,18 @@ static gboolean handle_xml(gint idx, gchar ch) return FALSE; } - if (strlen(str_found) > 0) + if (*str_found != '\0') { gchar *to_insert; if (ch == '/') - to_insert = g_strconcat(str_found, ">", NULL); + { + gchar *gt = ">"; + // if there is already a '>' behind the cursor, don't add it + if (sci_get_char_at(sci, pos) == '>') + gt = ""; + + to_insert = g_strconcat(str_found, gt, NULL); + } else to_insert = g_strconcat("", NULL); sci_start_undo_action(sci); @@ -1387,7 +1394,6 @@ static gboolean handle_xml(gint idx, gchar ch) return TRUE; } - g_free(str_found); return FALSE; }