Huw Davies : riched20: Use ME_PointFromChar to calculate the caret position .

Alexandre Julliard julliard at winehq.org
Fri Feb 15 11:19:17 CST 2013


Module: wine
Branch: master
Commit: 1c0aaf7dd27b5ed00a5319e0e0506287bd02f606
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1c0aaf7dd27b5ed00a5319e0e0506287bd02f606

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri Feb 15 16:13:41 2013 +0000

riched20: Use ME_PointFromChar to calculate the caret position.

---

 dlls/riched20/caret.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index 4986f6e..76c169b 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -205,7 +205,7 @@ ME_GetCursorCoordinates(ME_TextEditor *editor, ME_Cursor *pCursor,
   ME_DisplayItem *para = pCursor->pPara;
   ME_DisplayItem *pSizeRun = run;
   ME_Context c;
-  SIZE sz = {0, 0};
+  int run_x;
 
   assert(height && x && y);
   assert(~para->member.para.nFlags & MEPF_REWRAP);
@@ -235,18 +235,12 @@ ME_GetCursorCoordinates(ME_TextEditor *editor, ME_Cursor *pCursor,
       pSizeRun = run = tmp;
       assert(run);
       assert(run->type == diRun);
-      sz = ME_GetRunSize(&c, &para->member.para,
-                         &run->member.run, run->member.run.len,
-                         row->member.row.nLMargin);
     }
   }
-  if (pCursor->nOffset) {
-    sz = ME_GetRunSize(&c, &para->member.para, &run->member.run,
-                       pCursor->nOffset, row->member.row.nLMargin);
-  }
+  run_x = ME_PointFromCharContext( &c, &run->member.run, pCursor->nOffset );
 
   *height = pSizeRun->member.run.nAscent + pSizeRun->member.run.nDescent;
-  *x = c.rcView.left + run->member.run.pt.x + sz.cx - editor->horz_si.nPos;
+  *x = c.rcView.left + run->member.run.pt.x + run_x - editor->horz_si.nPos;
   *y = c.rcView.top + para->member.para.pt.y + row->member.row.nBaseline
        + run->member.run.pt.y - pSizeRun->member.run.nAscent
        - editor->vert_si.nPos;




More information about the wine-cvs mailing list