PowerArgs.Cli.RichTextCommandLineReader.IsWriteable C# (CSharp) Method

IsWriteable() public static method

Determines if the given key is writable text
public static IsWriteable ( ConsoleKeyInfo info ) : bool
info System.ConsoleKeyInfo the key info
return bool
        public static bool IsWriteable(ConsoleKeyInfo info)
        {
            if (info.KeyChar == '\u0000') return false;
            if (info.Key == ConsoleKey.Escape) return false;

            return true;
        }

Usage Example

        public void RegisterKeyPress(ConsoleKeyInfo key)
        {
            Context.Reset();
            Context.KeyPressed       = key;
            Context.CharacterToWrite = new ConsoleCharacter(Context.KeyPressed.KeyChar);

            IKeyHandler handler = null;

            if (KeyHandlers.TryGetValue(Context.KeyPressed.Key, out handler) == false && RichTextCommandLineReader.IsWriteable(Context.KeyPressed))
            {
                WriteCharacterForPressedKey(Context.KeyPressed);
                DoSyntaxHighlighting(Context);
            }
            else if (handler != null)
            {
                handler.Handle(Context);

                if (Context.Intercept == false && RichTextCommandLineReader.IsWriteable(Context.KeyPressed))
                {
                    WriteCharacterForPressedKey(Context.KeyPressed);
                }

                DoSyntaxHighlighting(Context);
            }
            FireValueChanged();
        }
All Usage Examples Of PowerArgs.Cli.RichTextCommandLineReader::IsWriteable