|
@@ -7,11 +7,11 @@ namespace Terminal.Gui.Drivers;
|
|
/// Detects ansi escape sequences in strings that have been read from
|
|
/// Detects ansi escape sequences in strings that have been read from
|
|
/// the terminal (see <see cref="IAnsiResponseParser"/>).
|
|
/// the terminal (see <see cref="IAnsiResponseParser"/>).
|
|
/// Handles navigation CSI key parsing such as <c>\x1b[A</c> (Cursor up)
|
|
/// Handles navigation CSI key parsing such as <c>\x1b[A</c> (Cursor up)
|
|
-/// and <c>\x1b[1;5A</c> (Cursor up with Ctrl)
|
|
|
|
|
|
+/// and <c>\x1b[1;5A</c> (Cursor/Function with modifier(s))
|
|
/// </summary>
|
|
/// </summary>
|
|
public class CsiCursorPattern : AnsiKeyboardParserPattern
|
|
public class CsiCursorPattern : AnsiKeyboardParserPattern
|
|
{
|
|
{
|
|
- private readonly Regex _pattern = new (@"^\u001b\[(?:1;(\d+))?([A-DHF])$");
|
|
|
|
|
|
+ private readonly Regex _pattern = new (@"^\u001b\[(?:1;(\d+))?([A-DFHPQRS])$");
|
|
|
|
|
|
private readonly Dictionary<char, Key> _cursorMap = new ()
|
|
private readonly Dictionary<char, Key> _cursorMap = new ()
|
|
{
|
|
{
|
|
@@ -20,7 +20,13 @@ public class CsiCursorPattern : AnsiKeyboardParserPattern
|
|
{ 'C', Key.CursorRight },
|
|
{ 'C', Key.CursorRight },
|
|
{ 'D', Key.CursorLeft },
|
|
{ 'D', Key.CursorLeft },
|
|
{ 'H', Key.Home },
|
|
{ 'H', Key.Home },
|
|
- { 'F', Key.End }
|
|
|
|
|
|
+ { 'F', Key.End },
|
|
|
|
+
|
|
|
|
+ // F1–F4 as per xterm VT100-style CSI sequences
|
|
|
|
+ { 'P', Key.F1 },
|
|
|
|
+ { 'Q', Key.F2 },
|
|
|
|
+ { 'R', Key.F3 },
|
|
|
|
+ { 'S', Key.F4 }
|
|
};
|
|
};
|
|
|
|
|
|
/// <inheritdoc/>
|
|
/// <inheritdoc/>
|