Alex Villacís Lasso : riched20: Invalidate all the text on bogus last selection.

Alexandre Julliard julliard at winehq.org
Sat Dec 8 13:43:39 CST 2007


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

Author: Alex Villacís Lasso <a_villacis at palosanto.com>
Date:   Sat Dec  8 00:31:10 2007 -0500

riched20: Invalidate all the text on bogus last selection.

---

 dlls/riched20/paint.c |   37 +++++++++++++++++++------------------
 1 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index 7c40814..5f1d5b6 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -558,25 +558,26 @@ ME_InvalidateSelection(ME_TextEditor *editor)
   assert(para2->type == diParagraph);
   /* last selection markers aren't always updated, which means
   they can point past the end of the document */ 
-  if (editor->nLastSelStart > len)
-    editor->nLastSelEnd = len; 
-  if (editor->nLastSelEnd > len)
-    editor->nLastSelEnd = len; 
-    
-  /* if the start part of selection is being expanded or contracted... */
-  if (nStart < editor->nLastSelStart) {
-    ME_MarkForPainting(editor, para1, ME_FindItemFwd(editor->pLastSelStartPara, diParagraphOrEnd));
-  } else 
-  if (nStart > editor->nLastSelStart) {
-    ME_MarkForPainting(editor, editor->pLastSelStartPara, ME_FindItemFwd(para1, diParagraphOrEnd));
-  }
+  if (editor->nLastSelStart > len || editor->nLastSelEnd > len) {
+    ME_MarkForPainting(editor,
+        ME_FindItemFwd(editor->pBuffer->pFirst, diParagraph),
+        ME_FindItemFwd(editor->pBuffer->pFirst, diTextEnd));
+  } else {
+    /* if the start part of selection is being expanded or contracted... */
+    if (nStart < editor->nLastSelStart) {
+      ME_MarkForPainting(editor, para1, ME_FindItemFwd(editor->pLastSelStartPara, diParagraphOrEnd));
+    } else
+    if (nStart > editor->nLastSelStart) {
+      ME_MarkForPainting(editor, editor->pLastSelStartPara, ME_FindItemFwd(para1, diParagraphOrEnd));
+    }
 
-  /* if the end part of selection is being contracted or expanded... */
-  if (nEnd < editor->nLastSelEnd) {
-    ME_MarkForPainting(editor, para2, ME_FindItemFwd(editor->pLastSelEndPara, diParagraphOrEnd));
-  } else 
-  if (nEnd > editor->nLastSelEnd) {
-    ME_MarkForPainting(editor, editor->pLastSelEndPara, ME_FindItemFwd(para2, diParagraphOrEnd));
+    /* if the end part of selection is being contracted or expanded... */
+    if (nEnd < editor->nLastSelEnd) {
+      ME_MarkForPainting(editor, para2, ME_FindItemFwd(editor->pLastSelEndPara, diParagraphOrEnd));
+    } else
+    if (nEnd > editor->nLastSelEnd) {
+      ME_MarkForPainting(editor, editor->pLastSelEndPara, ME_FindItemFwd(para2, diParagraphOrEnd));
+    }
   }
 
   ME_InvalidateMarkedParagraphs(editor);




More information about the wine-cvs mailing list