From fded4ca7781ca2238f4cd4fd7994e9cfcad402f3 Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Mon, 4 Nov 2002 03:26:59 +0000 Subject: [PATCH] B08003 (from ) --- win/win32/mhmsgwnd.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/win/win32/mhmsgwnd.c b/win/win32/mhmsgwnd.c index ed6447bc4..ad9c0250e 100644 --- a/win/win32/mhmsgwnd.c +++ b/win/win32/mhmsgwnd.c @@ -184,14 +184,14 @@ LRESULT CALLBACK NHMessageWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM SetScrollInfo(hWnd, SB_HORZ, &si, TRUE); #endif - data->yMax = MSG_LINES - MSG_VISIBLE_LINES - 1; + data->yMax = MSG_LINES-1; data->yPos = min(data->yPos, data->yMax); ZeroMemory(&si, sizeof(si)); si.cbSize = sizeof(si); si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS; - si.nMin = 0; - si.nMax = MSG_LINES; + si.nMin = MSG_VISIBLE_LINES; + si.nMax = data->yMax + MSG_VISIBLE_LINES - 1; si.nPage = MSG_VISIBLE_LINES; si.nPos = data->yPos; SetScrollInfo(hWnd, SB_VERT, &si, TRUE); @@ -332,7 +332,8 @@ void onMSNH_VScroll(HWND hWnd, WPARAM wParam, LPARAM lParam) // of the scroll box, and update the window. UpdateWindow // sends the WM_PAINT message. - if (yInc = max(-data->yPos, min(yInc, data->yMax - data->yPos))) + if (yInc = max( MSG_VISIBLE_LINES - data->yPos, + min(yInc, data->yMax - data->yPos))) { data->yPos += yInc; /* ScrollWindowEx(hWnd, 0, -data->yChar * yInc, @@ -475,11 +476,11 @@ void onPaint(HWND hWnd) GetClientRect(hWnd, &client_rt); if( !IsRectEmpty(&ps.rcPaint) ) { - FirstLine = max (0, data->yPos + ps.rcPaint.top/data->yChar + 1); - LastLine = min (MSG_LINES-1, data->yPos + ps.rcPaint.bottom/data->yChar); - y = min( ps.rcPaint.bottom, client_rt.bottom - 2); + FirstLine = max (0, data->yPos - (client_rt.bottom - ps.rcPaint.top)/data->yChar + 1); + LastLine = min (MSG_LINES-1, data->yPos - (client_rt.bottom - ps.rcPaint.bottom)/data->yChar); + y = min( ps.rcPaint.bottom, client_rt.bottom ); for (i=LastLine; i>=FirstLine; i--) { - int lineidx = (data->last_line + 1 + i) % MSG_LINES; + int lineidx = (data->last_line + 1 + i) % MSG_LINES; x = data->xChar * (2 - data->xPos); draw_rt.left = x; -- 2.40.0