diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-06-14 09:53:15 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-06-14 09:53:15 +0000 |
commit | 7ff335b88d10f3f162847faae079069b2780b0a0 (patch) | |
tree | 2a2fa64900d6e2f9e420d82e67ec8a033be42f25 | |
parent | 38f0a1b2cb95943375b7c39a464bff8f5d769929 (diff) |
scroll the view to the cursor position after paste.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@341 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | ChangeLog.ja | 5 | ||||
-rw-r--r-- | src/compose.c | 30 |
3 files changed, 27 insertions, 12 deletions
@@ -1,5 +1,9 @@ 2005-06-14 + * src/compose.c: scroll the view to the cursor position after paste. + +2005-06-14 + * src/compose.c: don't scroll when view is created. compose_input_cb(): set cursor to the top when the text is replaced. diff --git a/ChangeLog.ja b/ChangeLog.ja index 0569ba10..d20029f6 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,5 +1,10 @@ 2005-06-14 + * src/compose.c: ペーストの後ビューをカーソル位置までスクロール + するようにした。 + +2005-06-14 + * src/compose.c: ビューが作成された時はスクロールしないようにした。 compose_input_cb(): テキストが置換されたときカーソルを先頭にセット するようにした。 diff --git a/src/compose.c b/src/compose.c index 75ee5a3d..238402b4 100644 --- a/src/compose.c +++ b/src/compose.c @@ -5765,35 +5765,39 @@ static void compose_paste_cb(Compose *compose) } else if (GTK_IS_TEXT_VIEW(compose->focused_editable)) { GtkTextView *text = GTK_TEXT_VIEW(compose->text); GtkTextBuffer *buffer; + GtkTextMark *mark; GtkClipboard *clipboard; buffer = gtk_text_view_get_buffer(text); + mark = gtk_text_buffer_get_insert(buffer); clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); gtk_text_buffer_paste_clipboard(buffer, clipboard, NULL, TRUE); + + gtk_text_view_scroll_mark_onscreen(text, mark); } } } static void compose_paste_as_quote_cb(Compose *compose) { + GtkTextView *text = GTK_TEXT_VIEW(compose->text); + GtkTextBuffer *buffer; + GtkTextMark *mark; + GtkClipboard *clipboard; gchar *str = NULL; const gchar *qmark; - if (compose->focused_editable && - GTK_WIDGET_HAS_FOCUS(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); - str = gtk_clipboard_wait_for_text(clipboard); - } - } + if (!compose->focused_editable || + !GTK_WIDGET_HAS_FOCUS(compose->focused_editable) || + !GTK_IS_TEXT_VIEW(compose->focused_editable)) + return; + buffer = gtk_text_view_get_buffer(text); + mark = gtk_text_buffer_get_insert(buffer); + clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); + str = gtk_clipboard_wait_for_text(clipboard); if (!str) return; @@ -5804,6 +5808,8 @@ static void compose_paste_as_quote_cb(Compose *compose) compose_quote_fmt(compose, NULL, "%Q", qmark, str); g_free(str); + + gtk_text_view_scroll_mark_onscreen(text, mark); } static void compose_allsel_cb(Compose *compose) |