MikoĊaj Zalewski wrote:
but your code doesn't release the selection on button up, which is rather strange when you do only mouse selection A+
I've checked it and currently the whole section is dead code as on WM_LBUTTONUP the (wParam&MK_LBUTTON) is always false.
However if I remove this condition I think my code is correct. I release the mouse capture - that's enough as the handler for WM_MOUSEMOVE and WM_LBUTTONUP checks if GetCapture() == PRIVATE(data)->hWnd. Setting has_selection = FALSE would means that the seletion has been removed - there would be no way to copy it to the clipboard. Also the window is not updated to show that the selection is removed.
I was mostly surprised by the fact you only removed the has_selection=false part. The whole change (the new version) makes more sense
I'll check if the spaces are removed for other console modes.
I tested it too (less extensively than you did), but came to the same conclusion :-/
I don't know if it's possible to write an automatic test as this requires mouse interaction, I don't know how to get a hWnd of a console windows.
GetConsoleWindow(), which is not implemented in Wine yet. Also, it's not clear whether it's the top level window or the child window. You could send the mouse events to that window. But that's not a top priority feature. It's better to fix the broken parts of wineconsole ;-)
Also it would fail on wine as by default it starts the ncurses backend.
the test could force the user backend (see the console test in kernel32 directory) A+