+2008-08-24 Miguel de Icaza <miguel@novell.com>
+
+ * TermInfoDriver.cs (GetKeyFromBuffer): Add support for reporting
+ Alt-LETTER sequences. They were ignored previously.
+
2008-08-22 Sebastien Pouliot <sebastien@ximian.com>
* AppDomainSetup.cs: Remove IAppDomainSetup for SL2. This helps
// Should never get called unless inited
public void WriteSpecialKey (char c)
{
- WriteSpecialKey (CreateKeyInfoFromInt (c));
+ WriteSpecialKey (CreateKeyInfoFromInt (c, false));
}
public bool IsSpecialKey (ConsoleKeyInfo key)
public bool IsSpecialKey (char c)
{
- return IsSpecialKey (CreateKeyInfoFromInt (c));
+ return IsSpecialKey (CreateKeyInfoFromInt (c, false));
}
public ConsoleColor BackgroundColor {
}
}
- ConsoleKeyInfo CreateKeyInfoFromInt (int n)
+ ConsoleKeyInfo CreateKeyInfoFromInt (int n, bool alt)
{
char c = (char) n;
ConsoleKey key = (ConsoleKey)n;
bool shift = false;
bool ctrl = false;
- bool alt = false;
if (n == 10) {
key = ConsoleKey.Enter;
if (!cooked || !rootmap.StartsWith (next)) {
readpos++;
AdjustBuffer ();
- return CreateKeyInfoFromInt (next);
+ return CreateKeyInfoFromInt (next, false);
}
int used;
TermInfoStrings str = rootmap.Match (buffer, readpos, writepos - readpos, out used);
- if ((int) str == -1)
- return null;
+ if ((int) str == -1){
+ // Escape sequences: alt keys are sent as ESC-key
+ if (buffer [readpos] == 27 && (writepos - readpos) >= 2){
+ readpos += 2;
+ AdjustBuffer ();
+ return CreateKeyInfoFromInt (buffer [readpos+1], true);
+ } else
+ return null;
+ }
ConsoleKeyInfo key;
if (keymap [str] != null) {
} else {
readpos++;
AdjustBuffer ();
- return CreateKeyInfoFromInt (next);
+ return CreateKeyInfoFromInt (next, false);
}
readpos += used;