#nullable enable namespace Terminal.Gui; /// /// Parses ANSI escape sequence strings that describe keyboard activity into . /// public class AnsiKeyboardParser { private readonly List _patterns = new () { new Ss3Pattern (), new CsiKeyPattern (), new EscAsAltPattern { IsLastMinute = true } }; /// /// Looks for any pattern that matches the and returns /// the matching pattern or if no matches. /// /// /// /// public AnsiKeyboardParserPattern? IsKeyboard (string? input, bool isLastMinute = false) { return _patterns.FirstOrDefault (pattern => pattern.IsLastMinute == isLastMinute && pattern.IsMatch (input)); } }