diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ChangeLog.ja | 5 | ||||
-rw-r--r-- | src/compose.c | 14 |
3 files changed, 21 insertions, 3 deletions
@@ -1,5 +1,10 @@ 2005-07-12 + * src/compose.c: compose_get_line_break_pos(): don't break line after + '-' (to protect e-mail address etc.). + +2005-07-12 + * src/main.c src/stock_pixmap.[ch] src/Makefile.am diff --git a/ChangeLog.ja b/ChangeLog.ja index 29d56413..c9778156 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,5 +1,10 @@ 2005-07-12 + * src/compose.c: compose_get_line_break_pos(): '-' の後で改行しない + ようにした(e-mail アドレス等を保護するため)。 + +2005-07-12 + * src/main.c src/stock_pixmap.[ch] src/Makefile.am diff --git a/src/compose.c b/src/compose.c index 9204c0ef..31827999 100644 --- a/src/compose.c +++ b/src/compose.c @@ -2062,6 +2062,7 @@ static gboolean compose_get_line_break_pos(GtkTextBuffer *buffer, gint pos = 0; gboolean can_break = FALSE; gboolean do_break = FALSE; + gboolean prev_hyphen = FALSE; gtk_text_iter_forward_to_line_end(&line_end); str = gtk_text_buffer_get_text(buffer, &iter, &line_end, FALSE); @@ -2095,7 +2096,7 @@ static gboolean compose_get_line_break_pos(GtkTextBuffer *buffer, gunichar wc; gint uri_len; - if (attr->is_line_break && can_break) + if (attr->is_line_break && can_break && !prev_hyphen) pos = i; /* don't wrap URI */ @@ -2112,9 +2113,11 @@ static gboolean compose_get_line_break_pos(GtkTextBuffer *buffer, } wc = g_utf8_get_char(p); - if (g_unichar_iswide(wc)) + if (g_unichar_iswide(wc)) { col += 2; - else if (*p == '\t') + if (prev_hyphen && can_break && attr->is_line_break) + pos = i; + } else if (*p == '\t') col += 8; else col++; @@ -2123,6 +2126,11 @@ static gboolean compose_get_line_break_pos(GtkTextBuffer *buffer, break; } + if (*p == '-') + prev_hyphen = TRUE; + else + prev_hyphen = FALSE; + p = g_utf8_next_char(p); can_break = TRUE; } |