Commit 0cd86e01 authored by Jinoh Kang's avatar Jinoh Kang Committed by Alexandre Julliard

riched20: Factor out undo-ignored status check.

parent 41d16358
...@@ -394,6 +394,11 @@ BOOL ME_Undo(ME_TextEditor *editor) DECLSPEC_HIDDEN; ...@@ -394,6 +394,11 @@ BOOL ME_Undo(ME_TextEditor *editor) DECLSPEC_HIDDEN;
BOOL ME_Redo(ME_TextEditor *editor) DECLSPEC_HIDDEN; BOOL ME_Redo(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_EmptyUndoStack(ME_TextEditor *editor) DECLSPEC_HIDDEN; void ME_EmptyUndoStack(ME_TextEditor *editor) DECLSPEC_HIDDEN;
static inline BOOL editor_undo_ignored(ME_TextEditor *editor)
{
return editor->nUndoMode == umIgnore;
}
/* txtsrv.c */ /* txtsrv.c */
HRESULT create_text_services( IUnknown *outer, ITextHost *text_host, IUnknown **unk, BOOL emulate_10 ) DECLSPEC_HIDDEN; HRESULT create_text_services( IUnknown *outer, ITextHost *text_host, IUnknown **unk, BOOL emulate_10 ) DECLSPEC_HIDDEN;
#ifdef __ASM_USE_THISCALL_WRAPPER #ifdef __ASM_USE_THISCALL_WRAPPER
......
...@@ -53,7 +53,7 @@ static void empty_redo_stack(ME_TextEditor *editor) ...@@ -53,7 +53,7 @@ static void empty_redo_stack(ME_TextEditor *editor)
void ME_EmptyUndoStack(ME_TextEditor *editor) void ME_EmptyUndoStack(ME_TextEditor *editor)
{ {
struct undo_item *cursor, *cursor2; struct undo_item *cursor, *cursor2;
if (editor->nUndoMode == umIgnore) if (editor->nUndoMode == umIgnore) /* NOTE don't use editor_undo_ignored() here! */
return; return;
TRACE("Emptying undo stack\n"); TRACE("Emptying undo stack\n");
...@@ -74,7 +74,7 @@ static struct undo_item *add_undo( ME_TextEditor *editor, enum undo_type type ) ...@@ -74,7 +74,7 @@ static struct undo_item *add_undo( ME_TextEditor *editor, enum undo_type type )
struct undo_item *undo, *item; struct undo_item *undo, *item;
struct list *head; struct list *head;
if (editor->nUndoMode == umIgnore) return NULL; if (editor_undo_ignored(editor)) return NULL;
if (editor->nUndoLimit == 0) return NULL; if (editor->nUndoLimit == 0) return NULL;
undo = heap_alloc( sizeof(*undo) ); undo = heap_alloc( sizeof(*undo) );
...@@ -229,7 +229,7 @@ void ME_CommitUndo(ME_TextEditor *editor) ...@@ -229,7 +229,7 @@ void ME_CommitUndo(ME_TextEditor *editor)
struct undo_item *item; struct undo_item *item;
struct list *head; struct list *head;
if (editor->nUndoMode == umIgnore) if (editor_undo_ignored(editor))
return; return;
assert(editor->nUndoMode == umAddToUndo); assert(editor->nUndoMode == umAddToUndo);
...@@ -267,7 +267,7 @@ void ME_ContinueCoalescingTransaction(ME_TextEditor *editor) ...@@ -267,7 +267,7 @@ void ME_ContinueCoalescingTransaction(ME_TextEditor *editor)
struct undo_item *item; struct undo_item *item;
struct list *head; struct list *head;
if (editor->nUndoMode == umIgnore) if (editor_undo_ignored(editor))
return; return;
assert(editor->nUndoMode == umAddToUndo); assert(editor->nUndoMode == umAddToUndo);
...@@ -303,7 +303,7 @@ void ME_CommitCoalescingUndo(ME_TextEditor *editor) ...@@ -303,7 +303,7 @@ void ME_CommitCoalescingUndo(ME_TextEditor *editor)
struct undo_item *item; struct undo_item *item;
struct list *head; struct list *head;
if (editor->nUndoMode == umIgnore) if (editor_undo_ignored(editor))
return; return;
assert(editor->nUndoMode == umAddToUndo); assert(editor->nUndoMode == umAddToUndo);
...@@ -323,7 +323,7 @@ void ME_CommitCoalescingUndo(ME_TextEditor *editor) ...@@ -323,7 +323,7 @@ void ME_CommitCoalescingUndo(ME_TextEditor *editor)
static void ME_PlayUndoItem(ME_TextEditor *editor, struct undo_item *undo) static void ME_PlayUndoItem(ME_TextEditor *editor, struct undo_item *undo)
{ {
if (editor->nUndoMode == umIgnore) if (editor_undo_ignored(editor))
return; return;
TRACE("Playing undo/redo item, id=%d\n", undo->type); TRACE("Playing undo/redo item, id=%d\n", undo->type);
...@@ -413,7 +413,7 @@ BOOL ME_Undo(ME_TextEditor *editor) ...@@ -413,7 +413,7 @@ BOOL ME_Undo(ME_TextEditor *editor)
struct list *head; struct list *head;
struct undo_item *undo, *cursor2; struct undo_item *undo, *cursor2;
if (editor->nUndoMode == umIgnore) return FALSE; if (editor_undo_ignored(editor)) return FALSE;
assert(nMode == umAddToUndo || nMode == umIgnore); assert(nMode == umAddToUndo || nMode == umIgnore);
head = list_head( &editor->undo_stack ); head = list_head( &editor->undo_stack );
...@@ -453,7 +453,7 @@ BOOL ME_Redo(ME_TextEditor *editor) ...@@ -453,7 +453,7 @@ BOOL ME_Redo(ME_TextEditor *editor)
assert(nMode == umAddToUndo || nMode == umIgnore); assert(nMode == umAddToUndo || nMode == umIgnore);
if (editor->nUndoMode == umIgnore) return FALSE; if (editor_undo_ignored(editor)) return FALSE;
head = list_head( &editor->redo_stack ); head = list_head( &editor->redo_stack );
if (!head) return FALSE; if (!head) return FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment