private void OnDeleteRange(object sender, DeleteRangeArgs args)
 {
     if (frozen_cnt == 0)
     {
         EraseAction action = new EraseAction(args.Start, args.End, chop_buffer);
         AddUndoAction(action);
     }
 }
        public override bool CanMerge(EditAction action)
        {
            EraseAction erase = action as EraseAction;

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

            // Don't group separate text cuts
            if (is_cut || erase.is_cut)
            {
                return(false);
            }

            // Must meet eachother
            if (start != (is_forward ? erase.start : erase.end))
            {
                return(false);
            }

            // Don't group deletes with backspaces
            if (is_forward != erase.is_forward)
            {
                return(false);
            }

            // Group if something other than text was deleted
            // (e.g. an email image)
            if (chop.Text.Length == 0 || erase.chop.Text.Length == 0)
            {
                return(true);
            }

            // Don't group more than one line (inclusive)
            if (chop.Text[0] == '\n')
            {
                return(false);
            }

            // Don't group more than one word (exclusive)
            if (erase.chop.Text[0] == ' ' || erase.chop.Text[0] == '\t')
            {
                return(false);
            }

            return(true);
        }
        public override void Merge(EditAction action)
        {
            EraseAction erase = (EraseAction)action;

            if (start == erase.start)
            {
                end     += erase.end - erase.start;
                chop.End = erase.chop.End;

                // Delete the marks, leave the text
                erase.chop.Destroy();
            }
            else
            {
                start = erase.start;

                TextIter chopStart = chop.Start;
                chop.Buffer.InsertRange(ref chopStart, erase.chop.Start, erase.chop.End);

                // Delete the marks and text
                erase.Destroy();
            }
        }
	private void OnDeleteRange (object sender, DeleteRangeArgs args)
	{
		if (frozen_cnt == 0) {
			EraseAction action = new EraseAction (args.Start, args.End, chop_buffer);
			AddUndoAction (action);
		}
	}