user32/edit: Don't set caret position when we don't have focus.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alistair Leslie-Hughes 2018-12-06 21:23:47 +00:00 committed by Alexandre Julliard
parent 0e33105abb
commit 7b742485f9
1 changed files with 8 additions and 4 deletions

View File

@ -1799,9 +1799,14 @@ static LRESULT EDIT_EM_Scroll(EDITSTATE *es, INT action)
static void EDIT_SetCaretPos(EDITSTATE *es, INT pos,
BOOL after_wrap)
{
LRESULT res = EDIT_EM_PosFromChar(es, pos, after_wrap);
TRACE("%d - %dx%d\n", pos, (short)LOWORD(res), (short)HIWORD(res));
SetCaretPos((short)LOWORD(res), (short)HIWORD(res));
LRESULT res;
if (es->flags & EF_FOCUSED)
{
res = EDIT_EM_PosFromChar(es, pos, after_wrap);
TRACE("%d - %dx%d\n", pos, (short)LOWORD(res), (short)HIWORD(res));
SetCaretPos((short)LOWORD(res), (short)HIWORD(res));
}
}
@ -1870,7 +1875,6 @@ static void EDIT_EM_ScrollCaret(EDITSTATE *es)
}
}
if(es->flags & EF_FOCUSED)
EDIT_SetCaretPos(es, es->selection_end, es->flags & EF_AFTER_WRAP);
}