|
@@ -15,6 +15,7 @@
|
|
|
|
|
|
#define HACK_CHECK_WINCHANGED
|
|
#define HACK_CHECK_WINCHANGED
|
|
|
|
|
|
|
|
+using System.Collections;
|
|
using System.ComponentModel;
|
|
using System.ComponentModel;
|
|
using System.Diagnostics;
|
|
using System.Diagnostics;
|
|
using System.Runtime.InteropServices;
|
|
using System.Runtime.InteropServices;
|
|
@@ -1446,7 +1447,6 @@ internal class WindowsDriver : ConsoleDriver
|
|
|
|
|
|
|
|
|
|
// Send DAR
|
|
// Send DAR
|
|
- WinConsole?.WriteANSI (EscSeqUtils.CSI_SendDeviceAttributes);
|
|
|
|
Parser.ExpectResponse (EscSeqUtils.CSI_ReportDeviceAttributes_Terminator,
|
|
Parser.ExpectResponse (EscSeqUtils.CSI_ReportDeviceAttributes_Terminator,
|
|
(e) =>
|
|
(e) =>
|
|
{
|
|
{
|
|
@@ -1464,8 +1464,17 @@ internal class WindowsDriver : ConsoleDriver
|
|
if (firstTime)
|
|
if (firstTime)
|
|
{
|
|
{
|
|
WinConsole?.WriteANSI (EscSeqUtils.CSI_SendDeviceAttributes);
|
|
WinConsole?.WriteANSI (EscSeqUtils.CSI_SendDeviceAttributes);
|
|
|
|
+ firstTime = false;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ foreach (var e in Parse (inputEvent))
|
|
|
|
+ {
|
|
|
|
+ ProcessInputAfterParsing (e);
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ internal void ProcessInputAfterParsing (WindowsConsole.InputRecord inputEvent)
|
|
|
|
+ {
|
|
|
|
|
|
switch (inputEvent.EventType)
|
|
switch (inputEvent.EventType)
|
|
{
|
|
{
|
|
@@ -1489,7 +1498,6 @@ internal class WindowsDriver : ConsoleDriver
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
if (inputEvent.KeyEvent.bKeyDown)
|
|
if (inputEvent.KeyEvent.bKeyDown)
|
|
{
|
|
{
|
|
// Avoid sending repeat key down events
|
|
// Avoid sending repeat key down events
|
|
@@ -1540,6 +1548,31 @@ internal class WindowsDriver : ConsoleDriver
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private IEnumerable<WindowsConsole.InputRecord> Parse (WindowsConsole.InputRecord inputEvent)
|
|
|
|
+ {
|
|
|
|
+ if (inputEvent.EventType != WindowsConsole.EventType.Key)
|
|
|
|
+ {
|
|
|
|
+ yield return inputEvent;
|
|
|
|
+ yield break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // TODO: For now ignore key up events completely
|
|
|
|
+ if (!inputEvent.KeyEvent.bKeyDown)
|
|
|
|
+ {
|
|
|
|
+ yield break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // TODO: Esc on its own is a problem - need a minute delay i.e. if you get Esc but nothing after release it.
|
|
|
|
+
|
|
|
|
+ // TODO: keydown/keyup badness
|
|
|
|
+
|
|
|
|
+ foreach (Tuple<char, WindowsConsole.InputRecord> output in
|
|
|
|
+ Parser.ProcessInput (Tuple.Create(inputEvent.KeyEvent.UnicodeChar,inputEvent)))
|
|
|
|
+ {
|
|
|
|
+ yield return output.Item2;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
#if HACK_CHECK_WINCHANGED
|
|
#if HACK_CHECK_WINCHANGED
|
|
private void ChangeWin (object s, SizeChangedEventArgs e)
|
|
private void ChangeWin (object s, SizeChangedEventArgs e)
|
|
{
|
|
{
|