riched20: Use para and row ptrs in the EM_GETFIRSTVISIBLELINE handler.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2020-11-02 08:23:16 +00:00 committed by Alexandre Julliard
parent 8046b5bc96
commit c5b1378756
1 changed files with 15 additions and 16 deletions

View File

@ -4044,25 +4044,24 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
return ((PARAFORMAT2 *)lParam)->dwMask; return ((PARAFORMAT2 *)lParam)->dwMask;
case EM_GETFIRSTVISIBLELINE: case EM_GETFIRSTVISIBLELINE:
{ {
ME_DisplayItem *p = editor->pBuffer->pFirst; ME_Paragraph *para = editor_first_para( editor );
ME_Row *row;
int y = editor->vert_si.nPos; int y = editor->vert_si.nPos;
int ypara = 0;
int count = 0; int count = 0;
int ystart, yend;
while(p) { while (para_next( para ))
p = ME_FindItemFwd(p, diStartRowOrParagraphOrEnd); {
if (p->type == diTextEnd) if (y < para->pt.y + para->nHeight) break;
break; count += para->nRows;
if (p->type == diParagraph) { para = para_next( para );
ypara = p->member.para.pt.y; }
continue;
} row = para_first_row( para );
ystart = ypara + p->member.row.pt.y; while (row)
yend = ystart + p->member.row.nHeight; {
if (y < yend) { if (y < para->pt.y + row->pt.y + row->nHeight) break;
break;
}
count++; count++;
row = row_next( row );
} }
return count; return count;
} }