From 336d84583c0e69ae0bbb923113b4cc7358bf70de Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Wed, 29 Sep 2004 21:04:18 +0000 Subject: [PATCH] Limit scrolling of the edit control to the last line of text. --- dlls/user/edit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/user/edit.c b/dlls/user/edit.c index 53e16991b5b..8f7156072d0 100644 --- a/dlls/user/edit.c +++ b/dlls/user/edit.c @@ -2783,6 +2783,8 @@ static BOOL EDIT_EM_LineScroll_internal(EDITSTATE *es, INT dx, INT dy) { INT nyoff; INT x_offset_in_pixels; + INT lines_per_page = (es->format_rect.bottom - es->format_rect.top) / + es->line_height; if (es->style & ES_MULTILINE) { @@ -2799,8 +2801,8 @@ static BOOL EDIT_EM_LineScroll_internal(EDITSTATE *es, INT dx, INT dy) if (dx > es->text_width - x_offset_in_pixels) dx = es->text_width - x_offset_in_pixels; nyoff = max(0, es->y_offset + dy); - if (nyoff >= es->line_count) - nyoff = es->line_count - 1; + if (nyoff >= es->line_count - lines_per_page) + nyoff = es->line_count - lines_per_page; dy = (es->y_offset - nyoff) * es->line_height; if (dx || dy) { RECT rc1;