RICHED20: fix hacky EM_POSFROMCHAR implementation

Krzysztof Foltman wdev at foltman.com
Fri Oct 7 10:36:47 CDT 2005


ChangeLog:
  * The previous implementation was a workaround for off-by-one bug in 
ME_RunOfsFromCharOfs, this one relies on correct behavior of that 
function introduced by the previous patch ("fix 1.0 emulation off-by-ones")

Krzysztof


-------------- next part --------------
Index: editor.c
===================================================================
RCS file: /home/wine/wine/dlls/riched20/editor.c,v
retrieving revision 1.59
diff -u -r1.59 editor.c
--- editor.c	3 Oct 2005 18:45:39 -0000	1.59
+++ editor.c	7 Oct 2005 15:21:06 -0000
@@ -1723,10 +1727,15 @@
         nCharOfs = lParam;
     nLength = ME_GetTextLength(editor);
     
-    if (nCharOfs < nLength-1) { 
+    if (nCharOfs < nLength) { 
         ME_RunOfsFromCharOfs(editor, nCharOfs, &pRun, &nOffset);
+        assert(pRun->type == diRun);
         pt.y = pRun->member.run.pt.y;
         pt.x = pRun->member.run.pt.x + ME_PointFromChar(editor, &pRun->member.run, nOffset);
+        pt.y += ME_GetParagraph(pRun)->member.para.nYPos;
+    } else {
+        pt.x = 0;
+        pt.y = editor->pBuffer->pLast->member.para.nYPos;
     }
     pt.y += ME_GetParagraph(pRun)->member.para.nYPos;
     if (wParam >= 0x40000) {


More information about the wine-patches mailing list