From 6237c2b776505f56d00457baae8173d163fc30e3 Mon Sep 17 00:00:00 2001 From: hiro Date: Wed, 2 Feb 2005 04:32:32 +0000 Subject: fixed text truncation bugs in compose window. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@70 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 7 +++++++ ChangeLog.ja | 9 +++++++++ src/compose.c | 47 ++++++++++++++++++++++------------------------- 3 files changed, 38 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index f20b47ce..7435c22f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-02-02 + + * src/compose.c: + text_inserted(): revalidate iterator so as not to invalidate it + after gtk_text_buffer_insert() while enabling auto wrapping. + Do paste-as-quotation directly inside compose_paste_as_quote_cb(). + 2005-02-01 * version 1.9.0 diff --git a/ChangeLog.ja b/ChangeLog.ja index e454b1ec..e0e0899e 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,3 +1,12 @@ +2005-02-02 + + * src/compose.c: + text_inserted(): 自動整形を有効にしているときに + gtk_text_buffer_insert() の後 iterator を無効にしないように、 + iterator を再び有効にするようにした。 + compose_paste_as_quote_cb() 中で直接引用としてペーストを行う + ようにした。 + 2005-02-01 * version 1.9.0 diff --git a/src/compose.c b/src/compose.c index 009ac342..1945cac3 100644 --- a/src/compose.c +++ b/src/compose.c @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -5651,27 +5652,32 @@ static void compose_paste_cb(Compose *compose) static void compose_paste_as_quote_cb(Compose *compose) { - compose->paste_as_quotation = TRUE; + gchar *str = NULL; + const gchar *qmark; if (compose->focused_editable && GTK_WIDGET_HAS_FOCUS(compose->focused_editable)) { - if (GTK_IS_EDITABLE(compose->focused_editable)) { - gtk_editable_paste_clipboard - (GTK_EDITABLE(compose->focused_editable)); - } else if (GTK_IS_TEXT_VIEW(compose->focused_editable)) { + if (GTK_IS_TEXT_VIEW(compose->focused_editable)) { GtkTextView *text = GTK_TEXT_VIEW(compose->text); GtkTextBuffer *buffer; GtkClipboard *clipboard; buffer = gtk_text_view_get_buffer(text); clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); - - gtk_text_buffer_paste_clipboard(buffer, clipboard, - NULL, TRUE); + str = gtk_clipboard_wait_for_text(clipboard); } } - compose->paste_as_quotation = FALSE; + if (!str) + return; + + if (prefs_common.quotemark && *prefs_common.quotemark) + qmark = prefs_common.quotemark; + else + qmark = "> "; + compose_quote_fmt(compose, NULL, "%Q", qmark, str); + + g_free(str); } static void compose_allsel_cb(Compose *compose) @@ -6106,25 +6112,16 @@ static void text_inserted(GtkTextBuffer *buffer, GtkTextIter *iter, G_CALLBACK(text_inserted), compose); - if (compose->paste_as_quotation) { - gchar *new_text; - gchar *qmark; + gtk_text_buffer_insert(buffer, iter, text, len); - if (len < 0) - len = strlen(text); - new_text = g_strndup(text, len); - if (prefs_common.quotemark && *prefs_common.quotemark) - qmark = prefs_common.quotemark; - else - qmark = "> "; - gtk_text_buffer_place_cursor(buffer, iter); - compose_quote_fmt(compose, NULL, "%Q", qmark, new_text); - g_free(new_text); - } else - gtk_text_buffer_insert(buffer, iter, text, len); + if (compose->autowrap) { + GtkTextMark *mark; - if (compose->autowrap) + mark = gtk_text_buffer_create_mark(buffer, NULL, iter, FALSE); compose_wrap_line_all_full(compose, TRUE); + gtk_text_buffer_get_iter_at_mark(buffer, iter, mark); + gtk_text_buffer_delete_mark(buffer, mark); + } g_signal_handlers_unblock_by_func(G_OBJECT(buffer), G_CALLBACK(text_inserted), -- cgit v1.2.3