public override bool DoKeyDown(Keys keysData, out string viShortcut, out bool scrollToCursor)
 {
     viShortcut     = null;
     scrollToCursor = true;
     if (!alwaysInputMode &&
         ((keysData & Keys.Control) == Keys.Control) &&
         ((keysData & Keys.OemOpenBrackets) == Keys.OemOpenBrackets))
     {
         ViReceiverData viData = this.viData;
         this.viData = null;
         context.SetState(new ViReceiver(viData, true));
         return(true);
     }
     return(false);
 }
 public override void ResetViInput()
 {
     viData = null;
 }
示例#3
0
        public override void DoOn()
        {
            ViReceiverData startData = this.startData;

            this.startData = null;
            if (controller.macrosExecutor != null &&
                controller.macrosExecutor.lastCommand != null &&
                startData != null)
            {
                controller.macrosExecutor.lastCommand.startData = startData;
            }
            foreach (Selection selection in controller.Selections)
            {
                selection.SetEmpty();
            }
            if (startData != null)
            {
                ClipboardExecutor.viLastInputChars = startData.inputChars;
                if (startData.action == 'o' || startData.action == 'O')
                {
                    for (int i = startData.forcedInput ? 0 : 1; i < startData.count; i++)
                    {
                        if (i > 0)
                        {
                            controller.InsertLineBreak();
                        }
                        foreach (char c in startData.inputChars)
                        {
                            ProcessInputChar(c);
                        }
                    }
                }
                else
                {
                    for (int i = startData.forcedInput ? 0 : 1; i < startData.count; i++)
                    {
                        foreach (char c in startData.inputChars)
                        {
                            ProcessInputChar(c);
                        }
                    }
                }
            }
            controller.processor.ResetCommandsBatching();
            if (offsetOnStart)
            {
                for (int i = 0; i < lines.selections.Count; i++)
                {
                    Selection selection = lines.selections[i];
                    if (selection.Empty)
                    {
                        Place place = lines.PlaceOf(selection.caret);
                        if (place.iChar > 0)
                        {
                            selection.anchor--;
                            selection.caret--;
                            if (selection.preferredPos > 0)
                            {
                                selection.preferredPos--;
                            }
                        }
                    }
                }
            }
        }
 public InputReceiver(ViReceiverData viData, bool alwaysInputMode)
 {
     this.viData          = viData;
     this.alwaysInputMode = alwaysInputMode;
 }
示例#5
0
 public ViReceiver(ViReceiverData startData, bool offsetOnStart)
 {
     this.startData     = startData;
     this.offsetOnStart = offsetOnStart;
 }