riched20: ensure text is wrapped before invalidating selection (fixes Jan 2006 regression and bug#5769)

Krzysztof Foltman wdev at foltman.com
Fri Aug 4 16:40:06 CDT 2006


The fix is related to the fact, that the existing version of code did 
not ensure the text was properly wrapped before trying to invalidate the 
selection, which could (and did) result in unpredictable behavior (and 
assertion failures).

To ensure similar regressions don't go unnoticed, an assertion was added 
in ME_GetCursorCoordinates. Note that this change may reveal latent bugs 
somewhere else. But I guess that's a good thing, even if it reduces 
stability in short term.

Krzysztof
-------------- next part --------------
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index da52288..5124822 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -118,6 +118,7 @@ ME_GetCursorCoordinates(ME_TextEditor *e
 
   assert(!pCursor->nOffset || !editor->bCaretAtEnd);
   assert(height && x && y);
+  assert(!(ME_GetParagraph(pCursorRun)->member.para.nFlags & MEPF_REWRAP));
   
   if (pCursorRun->type == diRun) {
     ME_DisplayItem *row = ME_FindItemBack(pCursorRun, diStartRowOrParagraph);
diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index f3f5ac1..d1fe9db 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -493,6 +493,7 @@ ME_InvalidateFromOfs(ME_TextEditor *edit
 void
 ME_InvalidateSelection(ME_TextEditor *editor)
 {
+  ME_WrapMarkedParagraphs(editor);
   if (ME_IsSelection(editor) || editor->nLastSelStart != editor->nLastSelEnd)
   {
     int x, y, height;
diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c
old mode 100755
new mode 100644


More information about the wine-patches mailing list