riched20: Pass the correct range to the EN_LINK notification when the link is wrapped.
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3d1d65bc2c
commit
65feea4e5a
|
@ -2627,6 +2627,11 @@ static int ME_CalculateClickCount(ME_TextEditor *editor, UINT msg, WPARAM wParam
|
||||||
return clickNum;
|
return clickNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL is_link( ME_Run *run )
|
||||||
|
{
|
||||||
|
return (run->style->fmt.dwMask & CFM_LINK) && (run->style->fmt.dwEffects & CFE_LINK);
|
||||||
|
}
|
||||||
|
|
||||||
static BOOL ME_SetCursor(ME_TextEditor *editor)
|
static BOOL ME_SetCursor(ME_TextEditor *editor)
|
||||||
{
|
{
|
||||||
ME_Cursor cursor;
|
ME_Cursor cursor;
|
||||||
|
@ -2692,8 +2697,7 @@ static BOOL ME_SetCursor(ME_TextEditor *editor)
|
||||||
ME_Run *run;
|
ME_Run *run;
|
||||||
|
|
||||||
run = &cursor.pRun->member.run;
|
run = &cursor.pRun->member.run;
|
||||||
if (run->style->fmt.dwMask & CFM_LINK &&
|
if (is_link( run ))
|
||||||
run->style->fmt.dwEffects & CFE_LINK)
|
|
||||||
{
|
{
|
||||||
ITextHost_TxSetCursor(editor->texthost,
|
ITextHost_TxSetCursor(editor->texthost,
|
||||||
LoadCursorW(NULL, (WCHAR*)IDC_HAND),
|
LoadCursorW(NULL, (WCHAR*)IDC_HAND),
|
||||||
|
@ -3128,8 +3132,7 @@ static void ME_LinkNotify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM
|
||||||
ME_CharFromPos(editor, x, y, &cursor, &isExact);
|
ME_CharFromPos(editor, x, y, &cursor, &isExact);
|
||||||
if (!isExact) return;
|
if (!isExact) return;
|
||||||
|
|
||||||
if (cursor.pRun->member.run.style->fmt.dwMask & CFM_LINK &&
|
if (is_link( &cursor.pRun->member.run ))
|
||||||
cursor.pRun->member.run.style->fmt.dwEffects & CFE_LINK)
|
|
||||||
{ /* The clicked run has CFE_LINK set */
|
{ /* The clicked run has CFE_LINK set */
|
||||||
ME_DisplayItem *di;
|
ME_DisplayItem *di;
|
||||||
|
|
||||||
|
@ -3143,21 +3146,15 @@ static void ME_LinkNotify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM
|
||||||
|
|
||||||
/* find the first contiguous run with CFE_LINK set */
|
/* find the first contiguous run with CFE_LINK set */
|
||||||
info.chrg.cpMin = ME_GetCursorOfs(&cursor);
|
info.chrg.cpMin = ME_GetCursorOfs(&cursor);
|
||||||
for (di = cursor.pRun->prev;
|
di = cursor.pRun;
|
||||||
di && di->type == diRun && (di->member.run.style->fmt.dwMask & CFM_LINK) && (di->member.run.style->fmt.dwEffects & CFE_LINK);
|
while (ME_PrevRun( NULL, &di, FALSE ) && is_link( &di->member.run ))
|
||||||
di = di->prev)
|
|
||||||
{
|
|
||||||
info.chrg.cpMin -= di->member.run.len;
|
info.chrg.cpMin -= di->member.run.len;
|
||||||
}
|
|
||||||
|
|
||||||
/* find the last contiguous run with CFE_LINK set */
|
/* find the last contiguous run with CFE_LINK set */
|
||||||
info.chrg.cpMax = ME_GetCursorOfs(&cursor) + cursor.pRun->member.run.len;
|
info.chrg.cpMax = ME_GetCursorOfs(&cursor) + cursor.pRun->member.run.len;
|
||||||
for (di = cursor.pRun->next;
|
di = cursor.pRun;
|
||||||
di && di->type == diRun && (di->member.run.style->fmt.dwMask & CFM_LINK) && (di->member.run.style->fmt.dwEffects & CFE_LINK);
|
while (ME_NextRun( NULL, &di, FALSE ) && is_link( &di->member.run ))
|
||||||
di = di->next)
|
|
||||||
{
|
|
||||||
info.chrg.cpMax += di->member.run.len;
|
info.chrg.cpMax += di->member.run.len;
|
||||||
}
|
|
||||||
|
|
||||||
ITextHost_TxNotify(editor->texthost, info.nmhdr.code, &info);
|
ITextHost_TxNotify(editor->texthost, info.nmhdr.code, &info);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue