Exemple #1
0
 public TextAction PeekOrAdd(TextCursor cursor, TextAction.ActionType type)
 {
     if (UndoActions.Any() && UndoActions.Peek().Match(cursor, type))
     {
         return(UndoActions.Peek());
     }
     else
     {
         return(Add(cursor, type));
     }
 }
Exemple #2
0
 public TextAction PeekIf(TextCursor cursor, TextAction.ActionType type, Func <TextAction, bool> condition)
 {
     if (UndoActions.Any() && UndoActions.Peek().Match(cursor, type) && condition(UndoActions.Peek()))
     {
         return(UndoActions.Peek());
     }
     else
     {
         return(Add(cursor, type));
     }
 }
Exemple #3
0
        public TextAction Add(TextCursor cursor, TextAction.ActionType type)
        {
            TextAction action = new TextAction(cursor, type);

            UndoActions.Push(action);
            if (RedoActions.Any())
            {
                RedoActions.Clear();
            }
            return(action);
        }