예제 #1
0
 protected override void EndProcessing()
 {
     using (UseRequestedDispatchTables())
     {
         PSConsoleReadLine.RemoveKeyHandler(Chord);
     }
 }
예제 #2
0
        protected IDisposable UseRequestedDispatchTables()
        {
            bool inViMode           = PSConsoleReadLine.GetOptions().EditMode == EditMode.Vi;
            bool viModeParamPresent = MyInvocation.BoundParameters.ContainsKey("ViMode");

            if (inViMode || viModeParamPresent)
            {
                if (!inViMode)
                {
                    // "-ViMode" must have been specified explicitly. Well, okay... we can
                    // modify the Vi tables... but isn't that an odd thing to do from
                    // not-vi mode?
                    WriteWarning(PSReadLineResources.NotInViMode);
                }

                if (ViMode == ViMode.Command)
                {
                    return(PSConsoleReadLine.UseViCommandModeTables());
                }
                else // default if -ViMode not specified, invalid, or "Insert"
                {
                    return(PSConsoleReadLine.UseViInsertModeTables());
                }
            }

            return(null);
        }
예제 #3
0
 protected override void EndProcessing()
 {
     if (ParameterSetName.Equals(FunctionParameterSet))
     {
         var function   = (string)_dynamicParameters.Value[FunctionParameter].Value;
         var keyHandler = (Action <ConsoleKeyInfo?, object>)
                          Delegate.CreateDelegate(typeof(Action <ConsoleKeyInfo?, object>),
                                                  typeof(PSConsoleReadLine).GetMethod(function));
         BriefDescription = function;
         PSConsoleReadLine.SetKeyHandler(Chord, keyHandler, BriefDescription, Description);
     }
     else
     {
         PSConsoleReadLine.SetKeyHandler(Chord, ScriptBlock, BriefDescription, Description);
     }
 }
예제 #4
0
        protected override void EndProcessing()
        {
            bool bound   = true;
            bool unbound = true;

            if (_bound.HasValue && _unbound.HasValue)
            {
                bound   = _bound.Value.IsPresent;
                unbound = _unbound.Value.IsPresent;
            }
            else if (_bound.HasValue)
            {
                bound   = _bound.Value.IsPresent;
                unbound = false;
            }
            else if (_unbound.HasValue)
            {
                bound   = false;
                unbound = _unbound.Value.IsPresent;
            }
            WriteObject(PSConsoleReadLine.GetKeyHandlers(bound, unbound), true);
        }
예제 #5
0
 static PSConsoleReadLine()
 {
     _singleton  = new PSConsoleReadLine();
     _viRegister = new ViRegister(_singleton);
 }
예제 #6
0
 protected override void EndProcessing()
 {
     PSConsoleReadLine.RemoveKeyHandler(Chord);
 }
예제 #7
0
 protected override void EndProcessing()
 {
     PSConsoleReadLine.SetOptions(this);
 }
예제 #8
0
 protected override void EndProcessing()
 {
     WriteObject(PSConsoleReadLine.GetOptions());
 }
예제 #9
0
 static PSConsoleReadLine()
 {
     _singleton = new PSConsoleReadLine();
     _clipboard = new ViRegister(_singleton);
 }
예제 #10
0
 internal Prediction(PSConsoleReadLine singleton)
 {
     _singleton = singleton;
     SetViewStyle(PSConsoleReadLineOptions.DefaultPredictionViewStyle);
 }
예제 #11
0
 internal PredictionInlineView(PSConsoleReadLine singleton)
     : base(singleton)
 {
 }
예제 #12
0
 internal PredictionListView(PSConsoleReadLine singleton)
     : base(singleton)
 {
     Reset();
 }
예제 #13
0
 protected PredictionViewBase(PSConsoleReadLine singleton)
 {
     _singleton = singleton;
 }
예제 #14
0
 /// <summary>
 /// Initialize a new instance of the <see cref="ViRegister" /> class.
 /// </summary>
 /// <param name="singleton">The <see cref="PSConsoleReadLine" /> object.
 /// Used to hook into the undo / redo subsystem as part of
 /// pasting the contents of the register into a buffer.
 /// </param>
 public ViRegister(PSConsoleReadLine singleton)
 {
     _singleton = singleton;
 }