Bug 3984 - Copy-paste in find/filter field works incorrectly
Summary: Copy-paste in find/filter field works incorrectly
Status: RESOLVED FIXED
Alias: None
Product: Claws Mail
Classification: Unclassified
Component: UI/Message List (show other bugs)
Version: 3.16.0
Hardware: PC Linux
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2018-03-09 13:21 CET by George
Modified: 2018-09-28 08:50 CEST (History)
0 users

See Also:


Attachments
Cleaner handling of keypresses for quicksearch (5.48 KB, patch)
2018-03-09 19:21 CET, Andrej Kacian
no flags Details | Diff
Fix the fix (584 bytes, patch)
2018-09-24 09:47 CEST, Colin Leroy
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description George 2018-03-09 13:21:26 CET
STR:

1. Open some folder
2. Choose to some way to filter/find messages, e.g. "From/To/Cc/Subject/Tag"
3. Type some text, e.g. ABC
4. Select the typed text
5. Ctrl+C to copy
6. Ctrl+V to paste

EXPECTED:
Ctrl+V should paste ABC

ACTUAL:
Ctrl+V pastes the text of the currently selected message body (which implies that Ctrl+C has copied actually that text and not what was selected in the typing field)
Comment 1 Andrej Kacian 2018-03-09 19:21:07 CET
Created attachment 1853 [details]
Cleaner handling of keypresses for quicksearch

The handling of key presses can a bit awkward in GTK. What happens here is that the main window gets the keypress first, and the /Edit/Copy menu item gets executed, while the GtkEntry in quicksearch box never even receives this keypress event.

This has been sort-of handled for certain keypresses, in a rather messy way (the main_window_accel_activate() and quicksearch_pass_key()) functions. Attached patch changes it to be cleaner - if quicksearch has focus, main window's accelerators are ignored, and instead the signal gets propagated (well, re-emitted) directly to the quicksearch GtkEntry.

Although the behavior seems to be correct with this patch, and there seem to be no side effects, I would still prefer if other people would test it, because this solution seems too easy to be complete. :)
Comment 2 George 2018-03-09 22:47:41 CET
Thanks Andrej! That was quick :) As soon as these changes propagate to the openSUSE's server:mail repository I will be able to test them.
Comment 3 users 2018-03-29 17:37:04 CEST
Changes related to this bug have been committed.
Please check latest Git and update the bug accordingly.
You can also get the patch from:
http://git.claws-mail.org/

++ ChangeLog	2018-03-29 17:37:04.011563057 +0200
http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=478d99a13b62c38fc55760bbe97c0db15dfa34a8
Merge: 8f0ab2e 7fafe08
Author: Colin Leroy <colin@colino.net>
Date:   Thu Mar 29 17:37:03 2018 +0200

    Merge branch 'master' of file:///home/git/claws

http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=7fafe08ddd93145b93b9f95a423ed2af8d9f9369
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Fri Mar 9 19:24:44 2018 +0100

    Change how main window's keyboard accelerators are bypassed when quicksearch has focus.
    
    Instead of artificially forwarding the keypress to quicksearch
    (only when Shift is pressed), we emit a new "key-press-event"
    signal directly to the quicksearch entry, and block the original
    signal before it reaches the accelerator handling.
    
    Closes bug #3984: Copy-paste in find/filter field works incorrectly
Comment 4 Colin Leroy 2018-09-24 09:31:31 CEST
Hi,

This fix fixes GTK's internal accelerators for copy-pasting, but breaks the rest of Claws Mail's own mainwindow accelerators when the quicksearch has focus.

Now if I search for a mail and need to reply to it, I can't hit Ctrl-R to do so unless I unfocus the quicksearch.

I'm not sure if that's a win.
Comment 5 Colin Leroy 2018-09-24 09:47:41 CEST
Created attachment 1923 [details]
Fix the fix

This patch keeps the nice code cleanup, and fixes the issue I have with it, without apparently breaking anything.

What do you think ?
Comment 6 George 2018-09-24 11:23:35 CEST
> This patch keeps the nice code cleanup

Could you please advise how to use it? I have learned how to compile using git source code but I don't know how to test patches. Need I manually apply the line changes or is there a command which would allow me to do it?

Currently I am running Claws Mail version 3.17.0git59
Comment 7 Colin Leroy 2018-09-26 18:06:08 CEST
Hi,

Save the patch file, and use:

patch -p1 < /path/to/the/patch.file

HTH :)
Comment 8 George 2018-09-27 19:20:06 CEST
Hi Colin,

I see this was commited to git. I could try it out. Your fix seems to work fine. Thanks!