Пример #1
0
        public override bool CanMerge(EditAction action)
        {
            InsertAction insert = action as InsertAction;

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

            // Don't group text pastes
            if (is_paste || insert.is_paste)
            {
                return(false);
            }

            // Must meet each other
            if (insert.index != index + chop.Length)
            {
                return(false);
            }

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

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

            return(true);
        }
Пример #2
0
        public override void Merge(EditAction action)
        {
            InsertAction insert = (InsertAction)action;

            chop.End = insert.Chop.End;

            insert.chop.Destroy();
        }
        // Action-creating event handlers...

        private void OnInsertText(object sender, InsertTextArgs args)
        {
            if (frozen_cnt == 0)
            {
                InsertAction action = new InsertAction(args.Pos, args.Text, args.Text.Length, chop_buffer);
                AddUndoAction(action);
            }
        }
	// Action-creating event handlers...
	
	private void OnInsertText (object sender, InsertTextArgs args)
	{
		if (frozen_cnt == 0) {
			InsertAction action = new InsertAction (args.Pos, args.Text, args.Text.Length, chop_buffer);
			AddUndoAction (action);
		}
	}