GNOME Bugzilla – Bug 127705
GtkTextView: middle mouse button paste behavior is inconsistent with other *NIX apps
Last modified: 2004-12-22 21:47:04 UTC
The MMB paste behavior is a little different from other apps. In gedit: 1. highlight some text 2. move mouse pointer to another location 3. click middle mouse button the highlighted text is copied to the new location, but the original text is still highlighted. If you begin typing, this original text is deleted. In most other GNOME apps, the highlighted text is copied, but then un-highlighted and the cursor jumps to the end of the pasted text. The user can then immendiately begin typing after the pasted code. Of course, I'm sure this is a user preference, but it is inconsistent with most other *NIX apps, and it's a little annoying to one that has become accustomed to the standard behavior. Cheers--
Which other GNOME apps? This is a GtkTextView/Buffer problem. Changing the summary too.
Sorry for the spam.
Abiword and Anjuta, for example (also XEmacs...and now that I think of it, the HTML text entry box that I'm currently typing into on Galeon is another example...). No matter where the cursor is on these applications, it will always move to the end of the pasted text after the middle mouse button is pressed. With the GtkTextView widget, the cursor stays where it was before the paste. Hope this helps---
*** This bug has been marked as a duplicate of 81880 ***
The following patch seems to fix it: in gtktextbuffer during pre_paste_prep we move the "insert" mark at the insertion point in gtktextview after having pasted the text we retrieve the "insert" mark and move the cursor to it making sure of also scroll the window if needed. (note that we cannot simply move the cursor to the iter retrieved at the button click because the clipboard would be emptied)
Oh well, mid air collision... posting the patch in the other bug