Module: wine Branch: master Commit: 5e5301273674c0c118aee70c44e553b9f1712d96 URL: http://source.winehq.org/git/wine.git/?a=commit;h=5e5301273674c0c118aee70c44...
Author: Huw Davies huw@codeweavers.com Date: Tue Feb 26 13:19:51 2013 +0000
riched20: Don't assume the the runs in a row are in visual order.
---
dlls/riched20/caret.c | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index 849e500..b41ee9e 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -869,6 +869,14 @@ static BOOL ME_FindRunInRow(ME_TextEditor *editor, ME_DisplayItem *pRow, int x, ME_Cursor *cursor, int *pbCaretAtEnd) { ME_DisplayItem *pNext, *pLastRun; + ME_Row *row = &pRow->member.row; + BOOL exact = TRUE; + + if (x < row->pt.x) + { + x = row->pt.x; + exact = FALSE; + } pNext = ME_FindItemFwd(pRow, diRunOrStartRow); assert(pNext->type == diRun); if (pbCaretAtEnd) *pbCaretAtEnd = FALSE; @@ -876,18 +884,13 @@ static BOOL ME_FindRunInRow(ME_TextEditor *editor, ME_DisplayItem *pRow, do { int run_x = pNext->member.run.pt.x; int width = pNext->member.run.nWidth; - if (x < run_x) - { - cursor->pRun = pNext; - cursor->pPara = ME_GetParagraph( cursor->pRun ); - return FALSE; - } + if (x >= run_x && x < run_x+width) { cursor->nOffset = ME_CharFromPoint(editor, x-run_x, &pNext->member.run, TRUE); cursor->pRun = pNext; cursor->pPara = ME_GetParagraph( cursor->pRun ); - return TRUE; + return exact; } pLastRun = pNext; pNext = ME_FindItemFwd(pNext, diRunOrStartRow);