Clinton Stimpson : riched20: Fix modification state for several operations.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jan 11 05:34:09 CST 2007


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

Author: Clinton Stimpson <cjstimpson at utwire.net>
Date:   Thu Jan 11 00:46:35 2007 -0700

riched20: Fix modification state for several operations.

---

 dlls/riched20/caret.c        |    3 +++
 dlls/riched20/editor.c       |    7 ++++++-
 dlls/riched20/tests/editor.c |    8 --------
 dlls/riched20/undo.c         |    3 ---
 4 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index a58d9f0..f6e0d7f 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -435,6 +435,9 @@ void ME_InsertTextFromCursor(ME_TextEdit
   /* Didn't affect performance for WM_SETTEXT (around 50sec/30K) */
   int freeSpace = editor->nTextLimit - ME_GetTextLength(editor);
 
+  /* text operations set modified state */
+  editor->nModifyStep = 1;
+
   assert(style);
 
   /* FIXME really HERE ? */
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 738a6fc..c939c81 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -1639,6 +1639,7 @@ LRESULT WINAPI RichEditANSIWndProc(HWND
     size_t len = wszText ? lstrlenW(wszText) : 0;
     int from, to;
     ME_Style *style;
+    int oldModify = editor->nModifyStep;
     TRACE("EM_SETTEXTEX - %s, flags %d, cp %d\n", debugstr_w(wszText), (int)pStruct->flags, pStruct->codepage);
     if (pStruct->codepage != 1200) {
       FIXME("EM_SETTEXTEX only supports unicode right now!\n"); 
@@ -1659,7 +1660,10 @@ LRESULT WINAPI RichEditANSIWndProc(HWND
     }
     ME_CommitUndo(editor);
     if (!(pStruct->flags & ST_KEEPUNDO))
+    {
+      editor->nModifyStep = oldModify;
       ME_EmptyUndoStack(editor);
+    }
     ME_UpdateRepaint(editor);
     return len;
   }
@@ -1690,7 +1694,7 @@ LRESULT WINAPI RichEditANSIWndProc(HWND
   case EM_SETMODIFY:
   {
     if (wParam)
-      editor->nModifyStep = 0x80000000;
+      editor->nModifyStep = 1;
     else
       editor->nModifyStep = 0;
     
@@ -1732,6 +1736,7 @@ LRESULT WINAPI RichEditANSIWndProc(HWND
       bRepaint = (from != to);
       ME_SetSelectionCharFormat(editor, p);
     }
+    editor->nModifyStep = 1;
     ME_CommitUndo(editor);
     if (bRepaint)
       ME_RewrapRepaint(editor);
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 281206a..687ab25 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -1192,10 +1192,8 @@ static void test_EM_GETMODIFY(void)
   SendMessage(hwndRichEdit, EM_SETMODIFY, FALSE, 0);
   SendMessage(hwndRichEdit, WM_SETFONT, (WPARAM)testFont,(LPARAM) MAKELONG((WORD) TRUE, 0));
   result = SendMessage(hwndRichEdit, EM_GETMODIFY, 0, 0);
-  todo_wine {
   ok (result == 0,
       "EM_GETMODIFY returned non-zero, instead of zero on setting font\n");
-  }
 
   /* setting text should set modify flag */
   SendMessage(hwndRichEdit, EM_SETMODIFY, FALSE, 0);
@@ -1207,20 +1205,16 @@ static void test_EM_GETMODIFY(void)
   /* undo previous text doesn't reset modify flag */
   SendMessage(hwndRichEdit, WM_UNDO, 0, 0);
   result = SendMessage(hwndRichEdit, EM_GETMODIFY, 0, 0);
-  todo_wine {
   ok (result != 0,
       "EM_GETMODIFY returned zero, instead of non-zero on undo after setting text\n");
-  }
   
   /* set text with no flag to keep undo stack should not set modify flag */
   SendMessage(hwndRichEdit, EM_SETMODIFY, FALSE, 0);
   setText.flags = 0;
   SendMessage(hwndRichEdit, EM_SETTEXTEX, (WPARAM)&setText, (LPARAM)TestItem1);
   result = SendMessage(hwndRichEdit, EM_GETMODIFY, 0, 0);
-  todo_wine {
   ok (result == 0,
       "EM_GETMODIFY returned non-zero, instead of zero when setting text while not keeping undo stack\n");
-  }
   
   /* WM_SETTEXT doesn't modify */
   SendMessage(hwndRichEdit, EM_SETMODIFY, FALSE, 0);
@@ -1295,10 +1289,8 @@ static void test_EM_GETMODIFY(void)
   pf2.wAlignment = PFA_RIGHT;
   SendMessage(hwndRichEdit, EM_SETPARAFORMAT, 0, (LPARAM) &pf2);
   result = SendMessage(hwndRichEdit, EM_GETMODIFY, 0, 0);
-  todo_wine {
   ok (result == 0,
       "EM_GETMODIFY returned zero, instead of non-zero for EM_SETPARAFORMAT\n");
-  }
 
   /* EM_STREAM */
   SendMessage(hwndRichEdit, EM_SETMODIFY, FALSE, 0);
diff --git a/dlls/riched20/undo.c b/dlls/riched20/undo.c
index 181121a..88de04a 100644
--- a/dlls/riched20/undo.c
+++ b/dlls/riched20/undo.c
@@ -163,7 +163,6 @@ void ME_CommitUndo(ME_TextEditor *editor
     
   ME_AddUndoItem(editor, diUndoEndTransaction, NULL);
   ME_SendSelChange(editor);
-  editor->nModifyStep++;
 }
 
 void ME_PlayUndoItem(ME_TextEditor *editor, ME_DisplayItem *pItem)
@@ -260,7 +259,6 @@ void ME_Undo(ME_TextEditor *editor) {
   if (p)
     p->prev = NULL;
   editor->nUndoMode = nMode;
-  editor->nModifyStep--;
   ME_UpdateRepaint(editor);
 }
 
@@ -293,6 +291,5 @@ void ME_Redo(ME_TextEditor *editor) {
   if (p)
     p->prev = NULL;
   editor->nUndoMode = nMode;
-  editor->nModifyStep++;
   ME_UpdateRepaint(editor);
 }




More information about the wine-cvs mailing list