[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sylpheed
Subject:    [sylpheed:24947] Cursor position after inserting a signature
From:       Godwin Stewart <gstewart () bonivet ! net>
Date:       2005-05-19 9:26:59
Message-ID: 20050519112659.4e655d35.gstewart () bonivet ! net
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Right now: Ctrl+G inserts a signature and leaves the cursor after the
inserted signature.

Depending on the person with whom you're communicating, some of the more
"colourful" signatures in your stock might not be appropriate. The idea is
to be able to keep hitting Ctrl+G until a more suitable one comes up, then
simply go down to the bottom of the signature, hit Shift+Ctrl+End to select
everything until the end of the message (i.e.: the discarded sigs) and just
delete them instead of having to move back to the insertion point every
time. IIRC, this was the default behaviour for the GTK+1.2 version of
sylpheed.

The attached patch against svn revision 269 restores this behaviour.

-- 
G. Stewart - gstewart@bonivet.net

Good judgment comes from bad experience, and a lot of that comes from 
bad judgment.

["insertsig.patch.txt" (text/plain)]

diff -Nurw trunk.old/src/compose.c trunk/src/compose.c
--- trunk.old/src/compose.c	2005-05-19 11:18:52.000000000 +0200
+++ trunk/src/compose.c	2005-05-19 11:15:52.000000000 +0200
@@ -1529,6 +1529,8 @@
 	GtkTextBuffer *buffer;
 	GtkTextMark *mark;
 	GtkTextIter iter;
+	GtkTextIter insertpoint;
+	GtkTextMark *insertmark;
 	gchar *sig_str;
 	gboolean prev_autowrap;
 
@@ -1540,6 +1542,8 @@
 	buffer = gtk_text_view_get_buffer(text);
 	mark = gtk_text_buffer_get_insert(buffer);
 	gtk_text_buffer_get_iter_at_mark(buffer, &iter, mark);
+	insertpoint = iter;
+	insertmark = gtk_text_buffer_create_mark(buffer, "insertpoint", &insertpoint, TRUE);
 
 	if (replace) {
 		GtkTextIter start_iter, end_iter;
@@ -1570,6 +1574,9 @@
 		g_free(sig_str);
 	}
 
+	
+	gtk_text_buffer_get_iter_at_mark(buffer, &insertpoint, insertmark);
+	gtk_text_buffer_place_cursor(buffer, &insertpoint);
 	compose->autowrap = prev_autowrap;
 	if (compose->autowrap)
 		compose_wrap_all(compose);

[Attachment #6 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic