[PATCH 1/2] comctl32/edit: Move the call to EDIT_EM_SetSel outside the block

Nikolay Sivov nsivov at codeweavers.com
Wed Aug 22 16:03:07 CDT 2018


On 08/22/2018 11:50 PM, Gabriel Iv─âncescu wrote:

> Signed-off-by: Gabriel Iv─âncescu <gabrielopcode at gmail.com>
> ---
>
> It's called in every block anyway including the else block.
>
>   dlls/comctl32/edit.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/dlls/comctl32/edit.c b/dlls/comctl32/edit.c
> index 10ff5fb..c0904cb 100644
> --- a/dlls/comctl32/edit.c
> +++ b/dlls/comctl32/edit.c
> @@ -3308,19 +3308,17 @@ static LRESULT EDIT_WM_KeyDown(EDITSTATE *es, INT key)
>   				else
>   					EDIT_WM_Clear(es);
>   			} else {
> +				EDIT_EM_SetSel(es, (UINT)-1, 0, FALSE);
>   				if (shift) {
>   					/* delete character left of caret */
> -					EDIT_EM_SetSel(es, (UINT)-1, 0, FALSE);
>   					EDIT_MoveBackward(es, TRUE);
>   					EDIT_WM_Clear(es);
>   				} else if (control) {
>   					/* delete to end of line */
> -					EDIT_EM_SetSel(es, (UINT)-1, 0, FALSE);
>   					EDIT_MoveEnd(es, TRUE, FALSE);
>   					EDIT_WM_Clear(es);
>   				} else {
>   					/* delete character right of caret */
> -					EDIT_EM_SetSel(es, (UINT)-1, 0, FALSE);
>   					EDIT_MoveForward(es, TRUE);
>   					EDIT_WM_Clear(es);
>   				}

It probably makes sense to move EDIT_WM_Clear() too in the same patch. 
Also I think it's better to use ~0u if we're making the change.



More information about the wine-devel mailing list