Skip to content

Commit

Permalink
AnsiParser working with CursesDriver and WindowsDriver
Browse files Browse the repository at this point in the history
  • Loading branch information
tznind committed Oct 13, 2024
1 parent 30ad592 commit ac90ed9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -583,10 +583,11 @@ internal override MainLoop Init ()
return new MainLoop (_mainLoopDriver);
}

private AnsiResponseParser<KeyCode> Parser { get; set; } = new ();
private AnsiResponseParser Parser { get; set; } = new ();
/// <inheritdoc />
public override IAnsiResponseParser GetParser () => Parser;

private List<int> seen = new List<int> ();
internal void ProcessInput ()
{
int wch;
Expand All @@ -600,6 +601,8 @@ internal void ProcessInput ()

var k = KeyCode.Null;

seen.Add (wch);

if (code == Curses.KEY_CODE_YES)
{
while (code == Curses.KEY_CODE_YES && wch == Curses.KeyResize)
Expand Down Expand Up @@ -885,6 +888,14 @@ ref ConsoleKeyInfo [] cki
}
else
{
if (cki != null)
{
foreach (var c in cki)
{
Parser.ProcessInput (c.KeyChar.ToString());
}
}

k = ConsoleKeyMapping.MapConsoleKeyInfoToKeyCode (consoleKeyInfo);
keyEventArgs = new Key (k);
OnKeyDown (keyEventArgs);
Expand Down

0 comments on commit ac90ed9

Please sign in to comment.