RICHED20: debug and 1.0 emulation fixes

Krzysztof Foltman wdev at foltman.com
Tue Oct 4 13:02:33 CDT 2005


6th try already...

ChangeLog:
   * Debug messages are now directed to different channels (to avoid
jamming relay messages  ;)  )
   * Fixed bug in EM_POSFROMCHAR (which was secondary to one of the 1.0
emulation issues below)
   * Fixed two bugs in 1.0 emulation (before it's redone, which will be
long after 0.9 is released). One makes PTE installer pass the first
screen (bug 709, partial fix). Another fixes the inability to accept the
license in ChemSketch, bug 3440.

Krzysztof

-------------- next part --------------
Index: run.c
===================================================================
RCS file: /home/wine/wine/dlls/riched20/run.c,v
retrieving revision 1.12
diff -u -r1.12 run.c
--- run.c	22 Jul 2005 18:27:26 -0000	1.12
+++ run.c	3 Oct 2005 22:09:59 -0000
@@ -23,6 +23,8 @@
 #include "editor.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(richedit);
+WINE_DECLARE_DEBUG_CHANNEL(richedit_v);
+WINE_DECLARE_DEBUG_CHANNEL(richedit_vv);
 
 int ME_CanJoinRuns(ME_Run *run1, ME_Run *run2)
 {
@@ -72,26 +74,26 @@
 {
   ME_DisplayItem *p = editor->pBuffer->pFirst;
   int ofs = 0, ofsp = 0;
-  if(TRACE_ON(richedit))
+  if(TRACE_ON(richedit_vv))
   {
-    TRACE("---\n");
+    TRACE_(richedit_vv)("---\n");
     ME_DumpDocument(editor->pBuffer);
   }
   do {
     p = ME_FindItemFwd(p, diRunOrParagraphOrEnd);
     switch(p->type) {
       case diTextEnd:
-        TRACE("tend, real ofsp = %d, counted = %d\n", p->member.para.nCharOfs, ofsp+ofs);
+        TRACE_(richedit_v)("tend, real ofsp = %d, counted = %d\n", p->member.para.nCharOfs, ofsp+ofs);
         assert(ofsp+ofs == p->member.para.nCharOfs);
         return;
       case diParagraph:
-        TRACE("para, real ofsp = %d, counted = %d\n", p->member.para.nCharOfs, ofsp+ofs);
+        TRACE_(richedit_v)("para, real ofsp = %d, counted = %d\n", p->member.para.nCharOfs, ofsp+ofs);
         assert(ofsp+ofs == p->member.para.nCharOfs);
         ofsp = p->member.para.nCharOfs;
         ofs = 0;
         break;
       case diRun:
-        TRACE("run, real ofs = %d (+ofsp = %d), counted = %d, len = %d, txt = \"%s\", flags=%08x, fx&mask = %08lx\n",
+        TRACE_(richedit_v)("run, real ofs = %d (+ofsp = %d), counted = %d, len = %d, txt = \"%s\", flags=%08x, fx&mask = %08lx\n",
           p->member.run.nCharOfs, p->member.run.nCharOfs+ofsp, ofsp+ofs,
           p->member.run.strText->nLen, debugstr_w(p->member.run.strText->szData),
           p->member.run.nFlags,
@@ -143,6 +145,7 @@
 
     if (nCharOfs < pPara->member.para.next_para->member.para.nCharOfs)
     {
+      int eollen = 1;
       *ppRun = ME_FindItemFwd(pPara, diRun);
       assert(*ppRun);
       while (!((*ppRun)->member.run.nFlags & MERF_ENDPARA))
@@ -157,7 +160,10 @@
         }
         *ppRun = pNext;
       }
-      if (nCharOfs == nParaOfs + (*ppRun)->member.run.nCharOfs) {
+      /* the handling of bEmulateVersion10 may be a source of many bugs, I'm afraid */
+      eollen = (editor->bEmulateVersion10 ? 2 : 1);
+      if (nCharOfs >= nParaOfs + (*ppRun)->member.run.nCharOfs &&
+        nCharOfs < nParaOfs + (*ppRun)->member.run.nCharOfs + eollen) {
         *pOfs = 0;
         return;
       }
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	3 Oct 2005 22:10:00 -0000
@@ -1666,7 +1666,8 @@
     if (item_end)
       nNextLineOfs = ME_CharOfsFromRunOfs(editor, ME_FindItemFwd(item_end, diRun), 0);
     else
-      nNextLineOfs = ME_FindItemFwd(item, diParagraphOrEnd)->member.para.nCharOfs-1;
+      nNextLineOfs = ME_FindItemFwd(item, diParagraphOrEnd)->member.para.nCharOfs
+       - (editor->bEmulateVersion10?2:1);
     nChars = nNextLineOfs - nThisLineOfs;
     TRACE("EM_LINELENGTH(%d)==%d\n",wParam, nChars);
     return nChars;
@@ -1723,10 +1724,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) {
Index: list.c
===================================================================
RCS file: /home/wine/wine/dlls/riched20/list.c,v
retrieving revision 1.2
diff -u -r1.2 list.c
--- list.c	9 Mar 2005 11:48:59 -0000	1.2
+++ list.c	3 Oct 2005 22:10:00 -0000
@@ -21,7 +21,7 @@
 
 #include "editor.h"
 
-WINE_DEFAULT_DEBUG_CHANNEL(riched20);
+WINE_DEFAULT_DEBUG_CHANNEL(richedit_vv);
 
 void ME_InsertBefore(ME_DisplayItem *diWhere, ME_DisplayItem *diWhat)
 {
@@ -181,7 +181,7 @@
           pItem->member.run.nCharOfs);
         break;
       case diTextEnd:
-        TRACE("\nEnd\n");
+        TRACE("\nEnd (ofs=%d)\n", pItem->member.para.nCharOfs);
         break;
       default:
         break;



More information about the wine-patches mailing list