Ejemplo n.º 1
0
        protected override void Run()
        {
            var line = Editor.GetLine(Editor.Caret.Line);

            Editor.SetSelection(Editor.Caret.Offset, line.EndOffset);
            ClipboardActions.Cut(Editor);
        }
Ejemplo n.º 2
0
        protected override void Run()
        {
            var count = Math.Min(Math.Max(Count, 1), Editor.GetLine(Editor.Caret.Line).EndOffset - Editor.Caret.Offset);

            Editor.SetSelection(Editor.Caret.Offset, Editor.Caret.Offset + count);
            ClipboardActions.Cut(Editor);
        }
Ejemplo n.º 3
0
        protected void ChangeInside(char start, char end)
        {
            if (Editor.Text[Editor.Caret.Offset] != start)
            {
                return;
            }

            // FIXME: should not be restricted inside a line
            // FIXME: should find the *matching* character, not next
            int offset = StringUtils.FindNextInLine(Editor.Text, Editor.Caret.Offset, end);

            if (offset <= 0)
            {
                return;
            }

            CaretMoveActions.Right(Editor);
            if (Editor.Caret.Offset < offset)
            {
                Editor.SetSelection(Editor.Caret.Offset, offset);
                ClipboardActions.Cut(Editor);
            }

            RequestedMode = Mode.Insert;
        }
Ejemplo n.º 4
0
        protected override void Run()
        {
            int wordOffset = StringUtils.NextWordOffset(Editor.Text, Editor.Caret.Offset);

            Editor.SetSelection(Editor.Caret.Offset, wordOffset);
            ClipboardActions.Cut(Editor);
        }
Ejemplo n.º 5
0
        protected bool DeleteInside(char start, char end)
        {
            Tuple <int, int> offsets;

            if (start == end)
            {
                offsets = StringUtils.FindMatchingOffsetsInLine(Editor.Text, Editor.Caret.Offset, start);
            }
            else
            {
                offsets = StringUtils.FindMatchingOffsets(Editor.Text, Editor.Caret.Offset, start, end);
            }

            if (offsets.Item1 < 0 || offsets.Item2 < 0)
            {
                return(false);
            }

            if (offsets.Item1 < offsets.Item2 - 1)
            {
                Editor.SetSelection(offsets.Item1 + 1, offsets.Item2);
                ClipboardActions.Cut(Editor);
            }
            else
            {
                Editor.Caret.Offset = offsets.Item2;
            }

            return(true);
        }
Ejemplo n.º 6
0
        protected override void Run()
        {
            var range = _selector();

            DeleteRange(range);
            if (range != CommandRange.Empty)
            {
                // Make sure there is no more than one newline left inside block
                int del1 = NewLine.GetDelimiterLength(Editor.Text[range.Start - 1], Editor.Text[range.Start]);
                if (del1 > 0)
                {
                    int del2Start = range.Start - 1 + del1;
                    int del2      = NewLine.GetDelimiterLength(Editor.Text[del2Start],
                                                               Editor.Text[del2Start + 1]);
                    if (del2 > 0)
                    {
                        Editor.SetSelection(del2Start, del2Start + del2);
                        ClipboardActions.Cut(Editor);
                        // put caret on closingChar
                        int caret = Editor.Caret.Offset;
                        while (Char.IsWhiteSpace(Editor.Text[caret]))
                        {
                            caret++;
                        }
                        Editor.Caret.Offset = caret;
                    }
                }
            }
        }
 protected void DeleteRange(CommandRange range)
 {
     if (range.Length > 0)
     {
         Editor.SetSelection(range.Start, range.End);
         ClipboardActions.Cut(Editor);
     }
 }
Ejemplo n.º 8
0
        protected override void Run()
        {
            int start = Editor.Caret.Offset;

            CaretMoveActions.LineEnd(Editor);
            Editor.SetSelection(start, Editor.Caret.Offset);
            ClipboardActions.Cut(Editor);
            RequestedMode = Mode.Insert;
        }
Ejemplo n.º 9
0
        protected override void Run()
        {
            var range = _selector();

            if (range.Length > 0)
            {
                Editor.SetSelection(range.Start, range.End);
                ClipboardActions.Cut(Editor);
                RequestedMode = Mode.Insert;
            }
        }
Ejemplo n.º 10
0
 /// <summary>
 /// The cut menu handler
 /// </summary>
 /// <param name="sender">The sending object</param>
 /// <param name="e">The event arguments</param>
 private void OnCut(object sender, EventArgs e)
 {
     try
     {
         ClipboardActions.Cut(textEditor.TextArea.GetTextEditorData());
     }
     catch (Exception err)
     {
         ShowError(err);
     }
 }
Ejemplo n.º 11
0
        protected override void Run()
        {
            int offset = Editor.Caret.Offset;

            for (int i = 0; i < Count && offset < Editor.Length; i++)
            {
                offset = StringUtils.NextWordOffset(Editor.Text, offset);
            }

            Editor.SetSelection(Editor.Caret.Offset, offset);
            ClipboardActions.Cut(Editor);
        }
Ejemplo n.º 12
0
        protected override void Run()
        {
            var lineOffset = Editor.GetLine(Editor.Caret.Line).Offset;
            var count      = Math.Min(Math.Max(Count, 1), Editor.Caret.Offset - Editor.GetLine(Editor.Caret.Line).Offset);

            if (Editor.Caret.Column == 1 || count > Editor.Caret.Offset)
            {
                return;
            }
            Editor.SetSelection(Editor.Caret.Offset - (count), Editor.Caret.Offset);
            ClipboardActions.Cut(Editor);
        }
Ejemplo n.º 13
0
        protected override void Run()
        {
            for (int i = 0; i < Count; i++)
            {
                int start = Editor.Caret.Offset;
                var end   = StringUtils.FindNextInLine(Editor.Text, Editor.Caret.Offset, Argument);
                if (end <= 0)
                {
                    return;
                }

                end += findResultShift;

                Editor.SetSelection(start, end);
                ClipboardActions.Cut(Editor);
            }
        }
Ejemplo n.º 14
0
        protected override void Run()
        {
            // hack for last line, it doesn't actually cut the line though
            if (Editor.Caret.Offset == Editor.Text.Length)
            {
                var line = Editor.GetLine(Editor.Caret.Line);
                if (line.Offset == line.EndOffset)
                {
                    DeleteActions.Backspace(Editor);
                    return;
                }
            }

            Motion.SetSelectLines(Editor, Editor.Caret.Line, Editor.Caret.Line + Count + (Count > 0 ? -1 : 0));
            ClipboardActions.Cut(Editor);
            Motion.LineStart(Editor);
        }
Ejemplo n.º 15
0
 /// <summary>
 /// The cut menu handler
 /// </summary>
 /// <param name="sender">The sending object</param>
 /// <param name="e">The event arguments</param>
 private void OnCut(object sender, EventArgs e)
 {
     ClipboardActions.Cut(textEditor.TextArea.GetTextEditorData());
 }
Ejemplo n.º 16
0
 protected override void Run()
 {
     ClipboardActions.Cut(Editor);
     RequestedMode = Mode.Insert;
 }
Ejemplo n.º 17
0
 protected override void Run()
 {
     Editor.SetSelection(Editor.Caret.Offset, StringUtils.NextWordOffset(Editor.Text, Editor.Caret.Offset));
     ClipboardActions.Cut(Editor);
     RequestedMode = Mode.Insert;
 }
 bool IEditorOperations.CutSelection()
 {
     ClipboardActions.Cut(TextEditor.GetTextEditorData());
     return(true);
 }
Ejemplo n.º 19
0
 public void CutText(object obj, EventArgs args)
 {
     ClipboardActions.Cut(this.editor.GetTextEditorData());
 }