Huw Davies : riched20: Use a run ptr in the link notify function.
Alexandre Julliard
julliard at winehq.org
Mon Nov 2 16:21:19 CST 2020
Module: wine
Branch: master
Commit: 8046b5bc96d243293857109ed8b24d5813a39f64
URL: https://source.winehq.org/git/wine.git/?a=commit;h=8046b5bc96d243293857109ed8b24d5813a39f64
Author: Huw Davies <huw at codeweavers.com>
Date: Mon Nov 2 08:23:15 2020 +0000
riched20: Use a run ptr in the link notify function.
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/riched20/editor.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index b54b9334265..38553f7add3 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -3451,8 +3451,9 @@ static void ME_LinkNotify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM
int x,y;
BOOL isExact;
ME_Cursor cursor; /* The start of the clicked text. */
-
+ ME_Run *run;
ENLINK info;
+
x = (short)LOWORD(lParam);
y = (short)HIWORD(lParam);
ME_CharFromPos(editor, x, y, &cursor, &isExact);
@@ -3460,8 +3461,6 @@ static void ME_LinkNotify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM
if (is_link( &cursor.pRun->member.run ))
{ /* The clicked run has CFE_LINK set */
- ME_DisplayItem *di;
-
info.nmhdr.hwndFrom = NULL;
info.nmhdr.idFrom = 0;
info.nmhdr.code = EN_LINK;
@@ -3472,15 +3471,15 @@ static void ME_LinkNotify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM
/* find the first contiguous run with CFE_LINK set */
info.chrg.cpMin = ME_GetCursorOfs(&cursor);
- di = cursor.pRun;
- while (ME_PrevRun( NULL, &di, FALSE ) && is_link( &di->member.run ))
- info.chrg.cpMin -= di->member.run.len;
+ run = &cursor.pRun->member.run;
+ while ((run = run_prev( run )) && is_link( run ))
+ info.chrg.cpMin -= run->len;
/* find the last contiguous run with CFE_LINK set */
info.chrg.cpMax = ME_GetCursorOfs(&cursor) + cursor.pRun->member.run.len;
- di = cursor.pRun;
- while (ME_NextRun( NULL, &di, FALSE ) && is_link( &di->member.run ))
- info.chrg.cpMax += di->member.run.len;
+ run = &cursor.pRun->member.run;
+ while ((run = run_next( run )) && is_link( run ))
+ info.chrg.cpMax += run->len;
ITextHost_TxNotify(editor->texthost, info.nmhdr.code, &info);
}
More information about the wine-cvs
mailing list