From d7d8bbfc0484cf85984afb6ec66312d24f01f75c Mon Sep 17 00:00:00 2001 From: Rein Klazes Date: Mon, 26 Sep 2005 16:42:18 +0000 Subject: [PATCH] When scrolling, first update the new position of the control before calling UpdateWindow(). --- dlls/riched20/editor.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index fb38f637f66..888e59789f4 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -1097,7 +1097,7 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP SCROLLINFO si; ME_TextEditor *editor = (ME_TextEditor *)GetWindowLongW(hWnd, 0); - TRACE("hWnd %p msg %d (%s) %08x %08lx\n", + TRACE("hWnd %p msg %04x (%s) %08x %08lx\n", hWnd, msg, get_msg_name(msg), wParam, lParam); switch(msg) { @@ -1359,13 +1359,14 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP if (nPos<0) nPos = 0; if (nPos != editor->nScrollPosY) { + int dy = editor->nScrollPosY - nPos; + editor->nScrollPosY = nPos; + SetScrollPos(hWnd, SB_VERT, nPos, TRUE); if (editor->bRedraw) { - ScrollWindow(hWnd, 0, editor->nScrollPosY-nPos, NULL, NULL); - SetScrollPos(hWnd, SB_VERT, nPos, TRUE); + ScrollWindow(hWnd, 0, dy, NULL, NULL); UpdateWindow(hWnd); } - editor->nScrollPosY = nPos; } return TRUE; /* Should return false if a single line richedit control */ } @@ -1849,13 +1850,14 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP break; } if (nPos != editor->nScrollPosY) { + int dy = editor->nScrollPosY - nPos; + editor->nScrollPosY = nPos; + SetScrollPos(hWnd, SB_VERT, nPos, TRUE); if (editor->bRedraw) { - ScrollWindow(hWnd, 0, editor->nScrollPosY-nPos, NULL, NULL); - SetScrollPos(hWnd, SB_VERT, nPos, TRUE); + ScrollWindow(hWnd, 0, dy, NULL, NULL); UpdateWindow(hWnd); } - editor->nScrollPosY = nPos; } break; } @@ -1872,13 +1874,14 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP if (nPos<0) nPos = 0; if (nPos != editor->nScrollPosY) { + int dy = editor->nScrollPosY - nPos; + editor->nScrollPosY = nPos; + SetScrollPos(hWnd, SB_VERT, nPos, TRUE); if (editor->bRedraw) { - ScrollWindow(hWnd, 0, editor->nScrollPosY-nPos, NULL, NULL); - SetScrollPos(hWnd, SB_VERT, nPos, TRUE); + ScrollWindow(hWnd, 0, dy, NULL, NULL); UpdateWindow(hWnd); } - editor->nScrollPosY = nPos; } break; }