aboutsummaryrefslogtreecommitdiff
path: root/src/compose.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-06-14 09:53:15 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-06-14 09:53:15 +0000
commit7ff335b88d10f3f162847faae079069b2780b0a0 (patch)
tree2a2fa64900d6e2f9e420d82e67ec8a033be42f25 /src/compose.c
parent38f0a1b2cb95943375b7c39a464bff8f5d769929 (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
Diffstat (limited to 'src/compose.c')
-rw-r--r--src/compose.c30
1 files changed, 18 insertions, 12 deletions
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)