Juan Lang : riched20: Use helper function rather than goto to return found position.
Alexandre Julliard
julliard at winehq.org
Thu Sep 11 08:00:18 CDT 2008
Module: wine
Branch: master
Commit: fb30d61c97641c82b2a5dc2e130bd951709f5f7c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=fb30d61c97641c82b2a5dc2e130bd951709f5f7c
Author: Juan Lang <juan.lang at gmail.com>
Date: Wed Sep 10 11:08:46 2008 -0700
riched20: Use helper function rather than goto to return found position.
---
dlls/riched20/caret.c | 36 ++++++++++++++++++++----------------
1 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index 376318e..1780bc0 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -889,6 +889,23 @@ static ME_DisplayItem* ME_FindPixelPosInTableRow(int x, int y,
return para;
}
+static BOOL ME_ReturnFoundPos(ME_TextEditor *editor, ME_DisplayItem *found,
+ ME_Cursor *result, int rx, BOOL isExact)
+{
+ assert(found);
+ assert(found->type == diRun);
+ if ((found->member.run.nFlags & MERF_ENDPARA) || rx < 0)
+ rx = 0;
+ result->pRun = found;
+ result->nOffset = ME_CharFromPointCursor(editor, rx, &found->member.run);
+ if (editor->pCursors[0].nOffset == found->member.run.strText->nLen && rx)
+ {
+ result->pRun = ME_FindItemFwd(editor->pCursors[0].pRun, diRun);
+ result->nOffset = 0;
+ }
+ return isExact;
+}
+
/* Finds the run and offset from the pixel position.
*
* x & y are pixel positions in virtual coordinates into the rich edit control,
@@ -963,34 +980,21 @@ static BOOL ME_FindPixelPos(ME_TextEditor *editor, int x, int y,
case diRun:
rx = x - p->member.run.pt.x;
if (rx < p->member.run.nWidth)
- {
- found_here:
- assert(p->type == diRun);
- if ((p->member.run.nFlags & MERF_ENDPARA) || rx < 0)
- rx = 0;
- result->pRun = p;
- result->nOffset = ME_CharFromPointCursor(editor, rx, &p->member.run);
- if (editor->pCursors[0].nOffset == p->member.run.strText->nLen && rx)
- {
- result->pRun = ME_FindItemFwd(editor->pCursors[0].pRun, diRun);
- result->nOffset = 0;
- }
- return isExact;
- }
+ return ME_ReturnFoundPos(editor, p, result, rx, isExact);
break;
case diStartRow:
isExact = FALSE;
p = ME_FindItemFwd(p, diRun);
if (is_eol) *is_eol = 1;
rx = 0; /* FIXME not sure */
- goto found_here;
+ return ME_ReturnFoundPos(editor, p, result, rx, isExact);
case diCell:
case diParagraph:
case diTextEnd:
isExact = FALSE;
rx = 0; /* FIXME not sure */
p = last;
- goto found_here;
+ return ME_ReturnFoundPos(editor, p, result, rx, isExact);
default: assert(0);
}
last = p;
More information about the wine-cvs
mailing list