Limit scrolling of the edit control to the last line of text.

This commit is contained in:
James Hawkins 2004-09-29 21:04:18 +00:00 committed by Alexandre Julliard
parent 8e80468170
commit 336d84583c
1 changed files with 4 additions and 2 deletions

View File

@ -2783,6 +2783,8 @@ static BOOL EDIT_EM_LineScroll_internal(EDITSTATE *es, INT dx, INT dy)
{ {
INT nyoff; INT nyoff;
INT x_offset_in_pixels; 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) 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) if (dx > es->text_width - x_offset_in_pixels)
dx = es->text_width - x_offset_in_pixels; dx = es->text_width - x_offset_in_pixels;
nyoff = max(0, es->y_offset + dy); nyoff = max(0, es->y_offset + dy);
if (nyoff >= es->line_count) if (nyoff >= es->line_count - lines_per_page)
nyoff = es->line_count - 1; nyoff = es->line_count - lines_per_page;
dy = (es->y_offset - nyoff) * es->line_height; dy = (es->y_offset - nyoff) * es->line_height;
if (dx || dy) { if (dx || dy) {
RECT rc1; RECT rc1;