richedit: Removed some unused invalidation code (try 2)

Dylan Smith dylan.ah.smith at gmail.com
Wed Jan 21 09:10:10 CST 2009


(updated the patch so it applies to current code)

The ME_InvalidateFromOfs and ME_QueueInvalidateFromCursor functions are
never called, and the nInvalidOfs variable had its value set but never
used.

ME_InvalidateFromOfs just invalidates the end of the line starting at a
character identified by nCharOfs. ME_QueueInvalidateFromCursor stores
the offset of the cursor in nInvalidateOfs which is never used.  I
checked the commit they came from and saw that they were used to queue
the invalidation when delete or backspace key was pressed, and then the
end of the row at the cursor would be invalidated at the end of
ME_WrapMarkedParagraphs.

Currently invalidation is done by marking paragraphs with the
MEPF_REWRAP flag for content changes, and MEPF_REPAINT when the
paragraph just needs painting.  This also handles following rows on the
paragraph that need updating when the delete or backspace keys are
pressed.

Therefore this patch removes the unused code and variables.
---
 dlls/riched20/editor.c  |    1 -
 dlls/riched20/editor.h  |    1 -
 dlls/riched20/editstr.h |    1 -
 dlls/riched20/paint.c   |   25 -------------------------
 4 files changed, 0 insertions(+), 28 deletions(-)
-------------- next part --------------
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 09f3fb3..e6375b1 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -2720,7 +2720,6 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
   ed->pLastSelStartPara = ed->pLastSelEndPara = ME_FindItemFwd(ed->pBuffer->pFirst, diParagraph);
   ed->bWordWrap = (props & TXTBIT_WORDWRAP) != 0;
   ed->bHideSelection = FALSE;
-  ed->nInvalidOfs = -1;
   ed->pfnWordBreak = NULL;
   ed->lpOleCallback = NULL;
   ed->mode = TM_RICHTEXT | TM_MULTILEVELUNDO | TM_MULTICODEPAGE;
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index 53d6295..484acfb 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -233,7 +233,6 @@ void ME_RewrapRepaint(ME_TextEditor *editor);
 void ME_UpdateRepaint(ME_TextEditor *editor);
 void ME_EnsureVisible(ME_TextEditor *editor, ME_Cursor *pCursor);
 void ME_InvalidateSelection(ME_TextEditor *editor);
-void ME_QueueInvalidateFromCursor(ME_TextEditor *editor, int nCursor);
 BOOL ME_SetZoom(ME_TextEditor *editor, int numerator, int denominator);
 int  ME_twips2pointsX(ME_Context *c, int x);
 int  ME_twips2pointsY(ME_Context *c, int y);
diff --git a/dlls/riched20/editstr.h b/dlls/riched20/editstr.h
index 7ac476d..ccdf51d 100644
--- a/dlls/riched20/editstr.h
+++ b/dlls/riched20/editstr.h
@@ -363,7 +363,6 @@ typedef struct tagME_TextEditor
   RECT rcFormat;
   BOOL bDefaultFormatRect;
   BOOL bWordWrap;
-  int nInvalidOfs;
   int nTextLimit;
   EDITWORDBREAKPROCW pfnWordBreak;
   LPRICHEDITOLECALLBACK lpOleCallback;
diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index 728b623..3de26e1 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -1241,24 +1241,6 @@ void ME_EnsureVisible(ME_TextEditor *editor, ME_Cursor *pCursor)
 
 
 void
-ME_InvalidateFromOfs(ME_TextEditor *editor, int nCharOfs)
-{
-  RECT rc;
-  int x, y, height;
-  ME_Cursor tmp;
-
-  ME_RunOfsFromCharOfs(editor, nCharOfs, &tmp.pRun, &tmp.nOffset);
-  ME_GetCursorCoordinates(editor, &tmp, &x, &y, &height);
-
-  rc.left = 0;
-  rc.top = y;
-  rc.bottom = y + height;
-  rc.right = editor->rcFormat.right;
-  ITextHost_TxInvalidateRect(editor->texthost, &rc, FALSE);
-}
-
-
-void
 ME_InvalidateSelection(ME_TextEditor *editor)
 {
   ME_DisplayItem *para1, *para2;
@@ -1306,13 +1288,6 @@ ME_InvalidateSelection(ME_TextEditor *editor)
   assert(editor->pLastSelEndPara->type == diParagraph);
 }
 
-void
-ME_QueueInvalidateFromCursor(ME_TextEditor *editor, int nCursor)
-{
-  editor->nInvalidOfs = ME_GetCursorOfs(editor, nCursor);
-}
-
-
 BOOL
 ME_SetZoom(ME_TextEditor *editor, int numerator, int denominator)
 {


More information about the wine-patches mailing list