On Mon, Sep 17, 2018 at 02:48:05PM +0300, Gabriel Ivăncescu wrote:
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.
On Windows 7 auto-append behaves the same whether paste is driven by a WM_PASTE or a ^V. So you will at least need to handle WM_PASTE, which makes the ^V exclusion dubious.
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).
Ok, this part does seem to be necessary and if it turns out you do need to keep the ^V exception after handling WM_PASTE, then it'll have to move to a small helper function.
Huw.