void MoveEndOfLine()
 {
     ClearKilledTextBuffer();
     if (marked)
     {
         SciControl.LineEndExtend();
     }
     else
     {
         SciControl.LineEnd();
     }
 }
 void MoveBeginningOfLine()
 {
     ClearKilledTextBuffer();
     if (marked)
     {
         SciControl.HomeExtend();
     }
     else
     {
         SciControl.Home();
     }
 }
 void BackwardChar()
 {
     ClearKilledTextBuffer();
     if (marked)
     {
         SciControl.CharLeftExtend();
     }
     else
     {
         SciControl.CharLeft();
     }
 }
 void ForwardChar()
 {
     ClearKilledTextBuffer();
     if (marked)
     {
         SciControl.CharRightExtend();
     }
     else
     {
         SciControl.CharRight();
     }
 }
 void PreviousLine()
 {
     ClearKilledTextBuffer();
     if (marked)
     {
         SciControl.LineUpExtend();
     }
     else if (CompletionList.Active)
     {
         CompletionList.HandleKeys(SciControl, Keys.Up);
     }
     else
     {
         SciControl.LineUp();
     }
 }
 void NextLine(object sender)
 {
     ClearKilledTextBuffer();
     if (marked)
     {
         SciControl.LineDownExtend();
     }
     else if (CompletionList.Active)
     {
         CompletionList.HandleKeys(SciControl, Keys.Down);
     }
     else
     {
         SciControl.LineDown();
     }
 }
        void KeyboardQuit(object sender)
        {
            var quickFind = PluginBase.MainForm.GetQuickFind();

            if (quickFind != null && quickFind.ContainsFocus)
            {
                PluginBase.MainForm.SetFindText(null, "");
                quickFind.Hide();
                SciControl.Focus();
                return;
            }

            ClearKilledTextBuffer();
            marked = false;
            if (SciControl.SelectionStart != SciControl.SelectionEnd)
            {
                var backupPos = SciControl.CurrentPos;
                SciControl.ClearSelections(); // Caret move to head
                SciControl.GotoPos(backupPos);
            }
            RedispatchKeyEvent(sender, Keys.Escape);
        }
        void KillLine()
        {
            marked = false;
            int startPos = SciControl.CurrentPos;
            int endPos   = SciControl.LineEndPosition(SciControl.CurrentLine);

            if (startPos == endPos)
            {
                endPos = SciControl.PositionFromLine(SciControl.CurrentLine + 1);
                if (startPos == endPos)
                {
                    return;
                }
            }
            string currLineText = SciControl.GetCurLine(SciControl.CurLineSize);
            int    linePos      = SciControl.PositionFromLine(SciControl.CurrentLine);
            string cutText      = currLineText.Substring(startPos - linePos, endPos - startPos);

            SetKilledTextToClipboard(cutText, combinesWithBuf: true);
            SciControl.DeleteRange(startPos, endPos - startPos);
            SciControl.ChooseCaretX();
        }
 void Undo()
 {
     ClearKilledTextBuffer();
     marked = false;
     SciControl.Undo();
 }
 void Yank()
 {
     ClearKilledTextBuffer();
     marked = false;
     SciControl.Paste();
 }
 void KillRegion()
 {
     marked = false;
     ClearKilledTextBuffer();
     SciControl.Cut();
 }
 void DeleteBackwardChar()
 {
     marked = false;
     ClearKilledTextBuffer();
     SciControl.DeleteBack();
 }
 void DeleteChar()
 {
     marked = false;
     ClearKilledTextBuffer();
     SciControl.DeleteForward();
 }