Beispiel #1
0
        public void Merge(IUndoAction action)
        {
            EditableEraseAction erase = (EditableEraseAction)action;

            if (start == erase.start)
            {
                text += erase.text;
                end  += erase.end - erase.start;
            }
            else
            {
                text  = erase.text + text;
                start = erase.start;
            }
        }
Beispiel #2
0
        public bool CanMerge(IUndoAction action)
        {
            EditableEraseAction erase = action as EditableEraseAction;

            if (erase == null)
            {
                return(false);
            }

            return(!(
                       is_cut || erase.is_cut ||                          // don't group separate text cuts
                       start != (is_forward ? erase.start : erase.end) || // must meet eachother
                       is_forward != erase.is_forward ||                  // don't group deletes with backspaces
                       text[0] == '\n' ||                                 // don't group more than one line (inclusive)
                       erase.text[0] == ' ' || erase.text[0] == '\t'      // don't group more than one word (exclusive)
                       ));
        }