Huw Davies : riched20: Add a helper to debug the run text.
Alexandre Julliard
julliard at winehq.org
Wed Jan 30 13:43:23 CST 2013
Module: wine
Branch: master
Commit: c17af77b5ce7be2067b8eb5c35d11e82f5408fb2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c17af77b5ce7be2067b8eb5c35d11e82f5408fb2
Author: Huw Davies <huw at codeweavers.com>
Date: Wed Jan 30 15:10:19 2013 +0000
riched20: Add a helper to debug the run text.
---
dlls/riched20/caret.c | 6 +++---
dlls/riched20/editor.h | 2 ++
dlls/riched20/list.c | 2 +-
dlls/riched20/para.c | 2 +-
dlls/riched20/run.c | 12 ++++++------
dlls/riched20/wrap.c | 8 ++++----
6 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index b7dcaf7..d2203e2 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -374,15 +374,15 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
nCharsToDelete is a number of chars to delete from THIS run */
nChars -= nCharsToDelete;
shift -= nCharsToDelete;
- TRACE("Deleting %d (remaning %d) chars at %d in '%s' (%d)\n",
+ TRACE("Deleting %d (remaning %d) chars at %d in %s (%d)\n",
nCharsToDelete, nChars, c.nOffset,
- debugstr_w(run->strText->szData), run->strText->nLen);
+ debugstr_run( run ), run->strText->nLen);
/* nOfs is a character offset (from the start of the document
to the current (deleted) run */
add_undo_insert_run( editor, nOfs + nChars, run->strText->szData + c.nOffset, nCharsToDelete, run->nFlags, run->style );
- TRACE("Post deletion string: %s (%d)\n", debugstr_w(run->strText->szData), run->strText->nLen);
+ TRACE("Post deletion string: %s (%d)\n", debugstr_run( run ), run->strText->nLen);
TRACE("Shift value: %d\n", shift);
ME_StrDeleteV(run->strText, c.nOffset, nCharsToDelete);
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index 87e6351..0dba15f 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -56,6 +56,8 @@ static inline void * __WINE_ALLOC_SIZE(2) heap_realloc( void *ptr, size_t len )
(fe).lindex=-1;\
};
+static inline const char *debugstr_run( const ME_Run *run ) { return debugstr_w( run->strText->szData ); }
+
/* style.c */
ME_Style *ME_MakeStyle(CHARFORMAT2W *style) DECLSPEC_HIDDEN;
void ME_AddRefStyle(ME_Style *item) DECLSPEC_HIDDEN;
diff --git a/dlls/riched20/list.c b/dlls/riched20/list.c
index 15e9194..ef07420 100644
--- a/dlls/riched20/list.c
+++ b/dlls/riched20/list.c
@@ -211,7 +211,7 @@ void ME_DumpDocument(ME_TextBuffer *buffer)
TRACE(" - StartRow\n");
break;
case diRun:
- TRACE(" - Run(\"%s\", %d, flags=%x)\n", debugstr_w(pItem->member.run.strText->szData),
+ TRACE(" - Run(%s, %d, flags=%x)\n", debugstr_run( &pItem->member.run ),
pItem->member.run.nCharOfs, pItem->member.run.nFlags);
break;
case diTextEnd:
diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c
index c909358..2d572c9 100644
--- a/dlls/riched20/para.c
+++ b/dlls/riched20/para.c
@@ -410,7 +410,7 @@ ME_DisplayItem *ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp,
pTmp = ME_FindItemFwd(pTmp, diRunOrParagraphOrEnd);
if (pTmp->type != diRun)
break;
- TRACE("shifting \"%s\" by %d (previous %d)\n", debugstr_w(pTmp->member.run.strText->szData), shift, pTmp->member.run.nCharOfs);
+ TRACE("shifting %s by %d (previous %d)\n", debugstr_run( &pTmp->member.run ), shift, pTmp->member.run.nCharOfs);
pTmp->member.run.nCharOfs += shift;
pTmp->member.run.para = &tp->member.para;
} while(1);
diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c
index 0c594d3..3167c86 100644
--- a/dlls/riched20/run.c
+++ b/dlls/riched20/run.c
@@ -64,7 +64,7 @@ void ME_PropagateCharOffset(ME_DisplayItem *p, int shift)
*/
if (p->type == diRun) /* propagate in all runs in this para */
{
- TRACE("PropagateCharOffset(%s, %d)\n", debugstr_w(p->member.run.strText->szData), shift);
+ TRACE("PropagateCharOffset(%s, %d)\n", debugstr_run( &p->member.run ), shift);
do {
p->member.run.nCharOfs += shift;
assert(p->member.run.nCharOfs >= 0);
@@ -121,9 +121,9 @@ void ME_CheckCharOffsets(ME_TextEditor *editor)
ofs = 0;
break;
case diRun:
- TRACE_(richedit_check)("run, real ofs = %d (+ofsp = %d), counted = %d, len = %d, txt = \"%s\", flags=%08x, fx&mask = %08x\n",
+ TRACE_(richedit_check)("run, real ofs = %d (+ofsp = %d), counted = %d, len = %d, txt = %s, flags=%08x, fx&mask = %08x\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.strText->nLen, debugstr_run( &p->member.run ),
p->member.run.nFlags,
p->member.run.style->fmt.dwMask & p->member.run.style->fmt.dwEffects);
assert(ofs == p->member.run.nCharOfs);
@@ -265,7 +265,7 @@ ME_DisplayItem *ME_SplitRun(ME_WrapContext *wc, ME_DisplayItem *item, int nVChar
run = &item->member.run;
- TRACE("Before split: %s(%d, %d)\n", debugstr_w(run->strText->szData),
+ TRACE("Before split: %s(%d, %d)\n", debugstr_run( run ),
run->pt.x, run->pt.y);
ME_SplitRunSimple(editor, &cursor);
@@ -283,8 +283,8 @@ ME_DisplayItem *ME_SplitRun(ME_WrapContext *wc, ME_DisplayItem *item, int nVChar
ME_CheckCharOffsets(editor);
TRACE("After check after split\n");
TRACE("After split: %s(%d, %d), %s(%d, %d)\n",
- debugstr_w(run->strText->szData), run->pt.x, run->pt.y,
- debugstr_w(run2->strText->szData), run2->pt.x, run2->pt.y);
+ debugstr_run( run ), run->pt.x, run->pt.y,
+ debugstr_run( run2 ), run2->pt.x, run2->pt.y);
}
return cursor.pRun;
diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c
index 8ac14f9..b62d30b 100644
--- a/dlls/riched20/wrap.c
+++ b/dlls/riched20/wrap.c
@@ -189,7 +189,7 @@ static void ME_WrapEndParagraph(ME_WrapContext *wc, ME_DisplayItem *p)
if (p->type == diRun)
{
ME_Run *run = &p->member.run;
- TRACE("%s - (%d, %d)\n", debugstr_w(run->strText->szData), run->pt.x, run->pt.y);
+ TRACE("%s - (%d, %d)\n", debugstr_run(run), run->pt.x, run->pt.y);
}
p = p->next;
}
@@ -241,7 +241,7 @@ static ME_DisplayItem *ME_MaximizeSplit(ME_WrapContext *wc, ME_DisplayItem *p, i
/* this run is the end of spaces, so the run edge is a good point to split */
wc->pt = pp->member.run.pt;
wc->bOverflown = TRUE;
- TRACE("Split point is: %s|%s\n", debugstr_w(piter->member.run.strText->szData), debugstr_w(pp->member.run.strText->szData));
+ TRACE("Split point is: %s|%s\n", debugstr_run( &piter->member.run ), debugstr_run( &pp->member.run ));
return pp;
}
wc->pt = piter->member.run.pt;
@@ -266,7 +266,7 @@ static ME_DisplayItem *ME_SplitByBacktracking(ME_WrapContext *wc, ME_DisplayItem
if (pp)
return pp;
}
- TRACE("Must backtrack to split at: %s\n", debugstr_w(p->member.run.strText->szData));
+ TRACE("Must backtrack to split at: %s\n", debugstr_run( &p->member.run ));
if (wc->pLastSplittableRun)
{
if (wc->pLastSplittableRun->member.run.nFlags & (MERF_GRAPHICS|MERF_TAB))
@@ -303,7 +303,7 @@ static ME_DisplayItem *ME_SplitByBacktracking(ME_WrapContext *wc, ME_DisplayItem
return wc->pLastSplittableRun;
}
}
- TRACE("Backtracking failed, trying desperate: %s\n", debugstr_w(p->member.run.strText->szData));
+ TRACE("Backtracking failed, trying desperate: %s\n", debugstr_run( &p->member.run ));
/* OK, no better idea, so assume we MAY split words if we can split at all*/
if (idesp)
return ME_SplitRun(wc, piter, idesp);
More information about the wine-cvs
mailing list