mirror of
https://github.com/fasteddy516/SimplySerial.git
synced 2024-11-14 14:04:36 +00:00
Added outgoing processing for cursor keys.
This commit is contained in:
parent
c4284784d3
commit
24f01f22ba
@ -34,6 +34,13 @@ namespace SimplySerial
|
||||
static int bufferSize = 102400;
|
||||
static DateTime lastFlush = DateTime.Now;
|
||||
|
||||
static Dictionary<ConsoleKey, String> specialKeys = new Dictionary<ConsoleKey, String>
|
||||
{
|
||||
{ ConsoleKey.UpArrow, "\x1B[A" },
|
||||
{ ConsoleKey.DownArrow, "\x1B[B" },
|
||||
{ ConsoleKey.RightArrow, "\x1B[C" },
|
||||
{ ConsoleKey.LeftArrow, "\x1B[D" }
|
||||
};
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
@ -216,6 +223,10 @@ namespace SimplySerial
|
||||
Thread.Sleep(150); // sort of cheating here - by adding this delay we ensure that when we process the receive buffer it will contain the correct backspace control sequence
|
||||
}
|
||||
|
||||
// check for keys that require special processing (cursor keys, etc.)
|
||||
else if (specialKeys.ContainsKey(keyInfo.Key))
|
||||
serialPort.Write(specialKeys[keyInfo.Key]);
|
||||
|
||||
// everything else just gets sent right on through
|
||||
else
|
||||
serialPort.Write(Convert.ToString(keyInfo.KeyChar));
|
||||
|
Loading…
Reference in New Issue
Block a user