From b3893bb06bae9fa9b3ccbd65ecfe6cada9135924 Mon Sep 17 00:00:00 2001 From: hiro Date: Tue, 12 Jul 2005 12:30:20 +0000 Subject: don't break line after '-'. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@425 ee746299-78ed-0310-b773-934348b2243d --- src/compose.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3