Esempio n. 1
0
 protected override void EndProcessing()
 {
     using (UseRequestedDispatchTables())
     {
         PSConsoleReadLine.RemoveKeyHandler(Chord);
     }
 }
Esempio n. 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);
        }
Esempio n. 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);
     }
 }
Esempio n. 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);
        }
Esempio n. 5
0
 static PSConsoleReadLine()
 {
     _singleton  = new PSConsoleReadLine();
     _viRegister = new ViRegister(_singleton);
 }
Esempio n. 6
0
 protected override void EndProcessing()
 {
     PSConsoleReadLine.RemoveKeyHandler(Chord);
 }
Esempio n. 7
0
 protected override void EndProcessing()
 {
     PSConsoleReadLine.SetOptions(this);
 }
Esempio n. 8
0
 protected override void EndProcessing()
 {
     WriteObject(PSConsoleReadLine.GetOptions());
 }
Esempio n. 9
0
 static PSConsoleReadLine()
 {
     _singleton = new PSConsoleReadLine();
     _clipboard = new ViRegister(_singleton);
 }
Esempio n. 10
0
 internal Prediction(PSConsoleReadLine singleton)
 {
     _singleton = singleton;
     SetViewStyle(PSConsoleReadLineOptions.DefaultPredictionViewStyle);
 }
Esempio n. 11
0
 internal PredictionInlineView(PSConsoleReadLine singleton)
     : base(singleton)
 {
 }
Esempio n. 12
0
 internal PredictionListView(PSConsoleReadLine singleton)
     : base(singleton)
 {
     Reset();
 }
Esempio n. 13
0
 protected PredictionViewBase(PSConsoleReadLine singleton)
 {
     _singleton = singleton;
 }
Esempio n. 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;
 }