Phil Krylov : riched20: Fixed some selection painting bugs.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jan 13 07:31:12 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 8205252f10d5658d011cfdf6ba5957c38d601c86
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=8205252f10d5658d011cfdf6ba5957c38d601c86

Author: Phil Krylov <phil at newstar.rinet.ru>
Date:   Fri Jan 13 13:53:35 2006 +0100

riched20: Fixed some selection painting bugs.

---

 dlls/riched20/caret.c |    3 +--
 dlls/riched20/paint.c |   29 +++++++++++++++++------------
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index 74e17e0..ca58c6d 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -725,10 +725,9 @@ void ME_LButtonDown(ME_TextEditor *edito
       is_selection = 1;
     }
   }
+  ME_InvalidateSelection(editor);
   HideCaret(editor->hWnd);
   ME_MoveCaret(editor);
-  if (is_selection)
-    ME_Repaint(editor);
   ShowCaret(editor->hWnd);
   ME_ClearTempStyle(editor);
   ME_SendSelChange(editor);
diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index 6e4cfb2..0995482 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -2,6 +2,7 @@
  * RichEdit - painting functions
  *
  * Copyright 2004 by Krzysztof Foltman
+ * Copyright 2005 by Phil Krylov
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -265,25 +266,29 @@ void ME_DrawGraphics(ME_Context *c, int 
 
 static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Paragraph *para) {
   ME_Run *run = &rundi->member.run;
+  ME_DisplayItem *start = ME_FindItemBack(rundi, diStartRow);
   int runofs = run->nCharOfs+para->nCharOfs;
+  int nSelFrom, nSelTo;
+  const WCHAR wszSpace[] = {' ', 0};
   
+  ME_GetSelection(c->editor, &nSelFrom, &nSelTo);
+
+  /* Draw selected end-of-paragraph mark */
+  if (run->nFlags & MERF_ENDPARA && runofs >= nSelFrom && runofs < nSelTo)
+    ME_DrawTextWithStyle(c, x, y, wszSpace, 1, run->style, NULL, 0, 1,
+                         c->pt.y + start->member.row.nYPos,
+                         start->member.row.nHeight);
+          
   /* you can always comment it out if you need visible paragraph marks */
   if (run->nFlags & (MERF_ENDPARA|MERF_TAB)) 
     return;
-  if (run->nFlags & MERF_GRAPHICS) {
-    int blfrom, blto;
-    ME_GetSelection(c->editor, &blfrom, &blto);
-    ME_DrawGraphics(c, x, y, run, para, (runofs >= blfrom) && (runofs < blto));
-  } else
-  {
-    int blfrom, blto;
-    ME_DisplayItem *start = ME_FindItemBack(rundi, diStartRow);
-    ME_GetSelection(c->editor, &blfrom, &blto);
-    
+
+  if (run->nFlags & MERF_GRAPHICS)
+    ME_DrawGraphics(c, x, y, run, para, (runofs >= nSelFrom) && (runofs < nSelTo));
+  else
     ME_DrawTextWithStyle(c, x, y, 
       run->strText->szData, ME_StrVLen(run->strText), run->style, NULL, 
-        blfrom-runofs, blto-runofs, c->pt.y+start->member.row.nYPos, start->member.row.nHeight);
-  }
+        nSelFrom-runofs,nSelTo-runofs, c->pt.y+start->member.row.nYPos, start->member.row.nHeight);
 }
 
 COLORREF ME_GetBackColor(ME_TextEditor *editor)




More information about the wine-cvs mailing list