Esempio n. 1
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));
     }
 }
Esempio n. 2
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));
     }
 }
Esempio n. 3
0
        public bool Undo(out TextCursor cursor)
        {
            cursor = null;
            if (!UndoActions.Any())
            {
                return(false);
            }
            var action = UndoActions.Pop();

            cursor = action.Cursor;
            cursor.Undo(action);
            RedoActions.Push(action);
            return(UndoActions.Any());
        }