[PATCH 3/5] riched20: Use para and row ptrs in the EM_GETFIRSTVISIBLELINE handler.
Huw Davies
huw at codeweavers.com
Mon Nov 2 02:23:16 CST 2020
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
dlls/riched20/editor.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 38553f7add3..620cb4fedcb 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -4044,25 +4044,24 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
return ((PARAFORMAT2 *)lParam)->dwMask;
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 ypara = 0;
int count = 0;
- int ystart, yend;
- while(p) {
- p = ME_FindItemFwd(p, diStartRowOrParagraphOrEnd);
- if (p->type == diTextEnd)
- break;
- if (p->type == diParagraph) {
- ypara = p->member.para.pt.y;
- continue;
- }
- ystart = ypara + p->member.row.pt.y;
- yend = ystart + p->member.row.nHeight;
- if (y < yend) {
- break;
- }
+
+ while (para_next( para ))
+ {
+ if (y < para->pt.y + para->nHeight) break;
+ count += para->nRows;
+ para = para_next( para );
+ }
+
+ row = para_first_row( para );
+ while (row)
+ {
+ if (y < para->pt.y + row->pt.y + row->nHeight) break;
count++;
+ row = row_next( row );
}
return count;
}
--
2.23.0
More information about the wine-devel
mailing list