diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-02-18 09:26:14 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-02-18 09:26:14 +0000 |
commit | c7c54a272476bb96923da48d00328229b44fdbd0 (patch) | |
tree | c12c04fe41cbc938027f2f74b1a44a9123793785 | |
parent | cd8ecf73140f0d4fb86cefab85009498ed66db8d (diff) |
compose.c: removed extra spaces between the next line when joining.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@115 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ChangeLog.ja | 5 | ||||
-rw-r--r-- | src/compose.c | 34 |
3 files changed, 33 insertions, 11 deletions
@@ -1,5 +1,10 @@ 2005-02-18 + * src/compose.c: compose_join_next_line(): removed extra spaces + between the next line. + +2005-02-18 + * src/compose.c: compose_wrap_paragraph(): comply with 'Wrap quotation' setting. diff --git a/ChangeLog.ja b/ChangeLog.ja index 19fba03b..0f23f7e6 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,5 +1,10 @@ 2005-02-18 + * src/compose.c: compose_join_next_line(): 次の行との間の余分な + 空白を除去。 + +2005-02-18 + * src/compose.c: compose_wrap_paragraph(): 「引用部を自動整形する」 の設定に従うようにした。 diff --git a/src/compose.c b/src/compose.c index e9b77370..92b44d48 100644 --- a/src/compose.c +++ b/src/compose.c @@ -1936,7 +1936,7 @@ static gboolean compose_join_next_line(GtkTextBuffer *buffer, GtkTextIter *iter, const gchar *quote_str) { - GtkTextIter iter_ = *iter, prev, next; + GtkTextIter iter_ = *iter, cur, prev, next; PangoLogAttr attrs[3]; gchar *str; gchar *next_quote_str; @@ -1966,24 +1966,36 @@ static gboolean compose_join_next_line(GtkTextBuffer *buffer, gtk_text_buffer_delete(buffer, &iter_, &end); } - /* delete linebreak */ - prev = iter_; - gtk_text_iter_backward_char(&prev); - gtk_text_buffer_delete(buffer, &prev, &iter_); + /* delete linebreak and extra spaces */ + prev = cur = iter_; + while (gtk_text_iter_backward_char(&cur)) { + wc1 = gtk_text_iter_get_char(&cur); + if (!g_unichar_isspace(wc1)) + break; + prev = cur; + } + next = cur = iter_; + while (!gtk_text_iter_ends_line(&cur)) { + wc1 = gtk_text_iter_get_char(&cur); + if (!g_unichar_isspace(wc1)) + break; + gtk_text_iter_forward_char(&cur); + next = cur; + } + if (!gtk_text_iter_equal(&prev, &next)) + gtk_text_buffer_delete(buffer, &prev, &next); + iter_ = prev; /* insert space if required */ - next = iter_; gtk_text_iter_backward_char(&prev); wc1 = gtk_text_iter_get_char(&prev); wc2 = gtk_text_iter_get_char(&next); gtk_text_iter_forward_char(&next); str = gtk_text_buffer_get_text(buffer, &prev, &next, FALSE); pango_default_break(str, -1, NULL, attrs, 3); - if (!attrs[0].is_white && !attrs[1].is_white) { - if (!attrs[1].is_line_break || - (!g_unichar_iswide(wc1) || !g_unichar_iswide(wc2))) - gtk_text_buffer_insert(buffer, &iter_, " ", 1); - } + if (!attrs[1].is_line_break || + (!g_unichar_iswide(wc1) || !g_unichar_iswide(wc2))) + gtk_text_buffer_insert(buffer, &iter_, " ", 1); g_free(str); *iter = iter_; |