From dde4d61f5a46d156c98912c2b1558b8b43dbe7b3 Mon Sep 17 00:00:00 2001 From: Pascal Lessard Date: Sun, 15 Aug 1999 16:30:11 +0000 Subject: [PATCH] EM_SETSEL scrolls if outside of the visible range. "shift+home" selection improved in the edit control. --- controls/edit.c | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/controls/edit.c b/controls/edit.c index 03b7b97c5a4..f5e268f4729 100644 --- a/controls/edit.c +++ b/controls/edit.c @@ -358,6 +358,7 @@ LRESULT WINAPI EditWndProc( HWND hwnd, UINT msg, case EM_SETSEL: DPRINTF_EDIT_MSG32("EM_SETSEL"); EDIT_EM_SetSel(wnd, es, wParam, lParam, FALSE); + EDIT_EM_ScrollCaret(wnd, es); result = 1; break; @@ -1509,7 +1510,7 @@ static void EDIT_MoveHome(WND *wnd, EDITSTATE *es, BOOL extend) HIWORD(EDIT_EM_PosFromChar(wnd, es, es->selection_end, es->flags & EF_AFTER_WRAP)), NULL); else e = 0; - EDIT_EM_SetSel(wnd, es, e, extend ? es->selection_start : e, FALSE); + EDIT_EM_SetSel(wnd, es, extend ? es->selection_start : e, e, FALSE); EDIT_EM_ScrollCaret(wnd, es); } @@ -3028,22 +3029,26 @@ static void EDIT_WM_Copy(WND *wnd, EDITSTATE *es) */ static LRESULT EDIT_WM_Create(WND *wnd, EDITSTATE *es, LPCREATESTRUCTA cs) { - /* - * To initialize some final structure members, we call some helper - * functions. However, since the EDITSTATE is not consistent (i.e. - * not fully initialized), we should be very careful which - * functions can be called, and in what order. - */ - EDIT_WM_SetFont(wnd, es, 0, FALSE); - EDIT_EM_EmptyUndoBuffer(wnd, es); - - if (cs->lpszName && *(cs->lpszName) != '\0') { - EDIT_EM_ReplaceSel(wnd, es, FALSE, cs->lpszName); - /* if we insert text to the editline, the text scrolls out of the window, as the caret is placed after the insert pos normally; thus we reset es->selection... to 0 and update caret */ - es->selection_start = es->selection_end = 0; - EDIT_EM_ScrollCaret(wnd, es); - } - return 0; + /* + * To initialize some final structure members, we call some helper + * functions. However, since the EDITSTATE is not consistent (i.e. + * not fully initialized), we should be very careful which + * functions can be called, and in what order. + */ + EDIT_WM_SetFont(wnd, es, 0, FALSE); + EDIT_EM_EmptyUndoBuffer(wnd, es); + + if (cs->lpszName && *(cs->lpszName) != '\0') { + EDIT_EM_ReplaceSel(wnd, es, FALSE, cs->lpszName); + /* if we insert text to the editline, the text scrolls out + * of the window, as the caret is placed after the insert + * pos normally; thus we reset es->selection... to 0 and + * update caret + */ + es->selection_start = es->selection_end = 0; + EDIT_EM_ScrollCaret(wnd, es); + } + return 0; } -- 2.11.4.GIT