On Mon, Sep 17, 2018 at 1:10 PM, Huw Davies huw@codeweavers.com wrote:
The condition on flag setting is a hack. For paste you'll likely want a WM_PASTE handler. If pasting didn't work before, then leave it for a later patch, if it did work before this patch you'll have to add such a handler before this one.
Huw.
Well it has to be done this way, because this doesn't handle WM_PASTE (which can also happen with e.g. right-click on edit control and choose Paste), but a straight CTRL+V message, which can be sent by applications like AutoHotkey. This hack is needed to match Windows behavior.
Also the wParam >= ' ' is *very* needed to avoid control characters, *especially* backspace, otherwise you wouldn't be able to delete the last character with a backspace as it would immediately be auto-appended, it doesn't happen in Windows. Same thing with e.g. CTRL+X (Cut) sent via message directly, bypassing WM_CUT. (remember one of my previous band-aids had a hardcoded check for VK_BACK and VK_DELETE, I think handling all control characters is much more elegant and matches Windows, except for CTRL+V).
I'm not sure I can get rid of this hack at all and still guarantee correct behavior. I can, of course, add it as an extra patch following it, and only handle ACO_AUTOAPPEND in this patch. Is that ok? I'll still need the hack though in the next patch in such case, unless you have some better method.