mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Merge pull request #535 from BDisp/f11-f12-keys
Added F11 and F12 keys #220. Changed keyDownHandler to before keyHandler.
This commit is contained in:
@@ -136,6 +136,8 @@ namespace Terminal.Gui {
|
||||
case Curses.KeyF8: return Key.F8;
|
||||
case Curses.KeyF9: return Key.F9;
|
||||
case Curses.KeyF10: return Key.F10;
|
||||
case Curses.KeyF11: return Key.F11;
|
||||
case Curses.KeyF12: return Key.F12;
|
||||
case Curses.KeyUp: return Key.CursorUp;
|
||||
case Curses.KeyDown: return Key.CursorDown;
|
||||
case Curses.KeyLeft: return Key.CursorLeft;
|
||||
@@ -146,6 +148,7 @@ namespace Terminal.Gui {
|
||||
case Curses.KeyPPage: return Key.PageUp;
|
||||
case Curses.KeyDeleteChar: return Key.DeleteChar;
|
||||
case Curses.KeyInsertChar: return Key.InsertChar;
|
||||
case Curses.KeyTab: return Key.Tab;
|
||||
case Curses.KeyBackTab: return Key.BackTab;
|
||||
case Curses.KeyBackspace: return Key.Backspace;
|
||||
case Curses.ShiftKeyUp: return Key.CursorUp | Key.ShiftMask;
|
||||
@@ -418,12 +421,18 @@ namespace Terminal.Gui {
|
||||
} else {
|
||||
keyHandler (new KeyEvent (Key.Esc));
|
||||
}
|
||||
} else if (wch == Curses.KeyTab) {
|
||||
keyHandler (new KeyEvent (MapCursesKey (wch)));
|
||||
} else {
|
||||
keyHandler (new KeyEvent ((Key)wch));
|
||||
}
|
||||
// Cause OnKeyUp and OnKeyPressed. Note that the special handling for ESC above
|
||||
// will not impact KeyUp.
|
||||
keyUpHandler (new KeyEvent ((Key)wch));
|
||||
if (wch == Curses.KeyTab) {
|
||||
keyUpHandler (new KeyEvent (MapCursesKey (wch)));
|
||||
} else {
|
||||
keyUpHandler (new KeyEvent ((Key)wch));
|
||||
}
|
||||
}
|
||||
|
||||
Action<MouseEvent> mouseHandler;
|
||||
|
||||
@@ -685,8 +685,8 @@ namespace Terminal.Gui {
|
||||
} else {
|
||||
if (inputEvent.KeyEvent.bKeyDown) {
|
||||
// Key Down - Fire KeyDown Event and KeyStroke (ProcessKey) Event
|
||||
keyHandler (new KeyEvent (map));
|
||||
keyDownHandler (new KeyEvent (map));
|
||||
keyHandler (new KeyEvent (map));
|
||||
} else {
|
||||
keyUpHandler (new KeyEvent (map));
|
||||
}
|
||||
@@ -1016,7 +1016,7 @@ namespace Terminal.Gui {
|
||||
|
||||
return (Key)((uint)keyInfo.KeyChar);
|
||||
}
|
||||
if (key >= ConsoleKey.F1 && key <= ConsoleKey.F10) {
|
||||
if (key >= ConsoleKey.F1 && key <= ConsoleKey.F12) {
|
||||
var delta = key - ConsoleKey.F1;
|
||||
|
||||
return (Key)((int)Key.F1 + delta);
|
||||
|
||||
@@ -272,6 +272,14 @@ namespace Terminal.Gui {
|
||||
/// </summary>
|
||||
F10,
|
||||
/// <summary>
|
||||
/// F11 key.
|
||||
/// </summary>
|
||||
F11,
|
||||
/// <summary>
|
||||
/// F12 key.
|
||||
/// </summary>
|
||||
F12,
|
||||
/// <summary>
|
||||
/// The key code for the user pressing the tab key (forwards tab key).
|
||||
/// </summary>
|
||||
Tab,
|
||||
|
||||
@@ -101,6 +101,7 @@ namespace Unix.Terminal {
|
||||
public const int KeyEnd = unchecked((int)0x168);
|
||||
public const int KeyDeleteChar = unchecked((int)0x14a);
|
||||
public const int KeyInsertChar = unchecked((int)0x14b);
|
||||
public const int KeyTab = unchecked((int)0x009);
|
||||
public const int KeyBackTab = unchecked((int)0x161);
|
||||
public const int KeyF1 = unchecked((int)0x109);
|
||||
public const int KeyF2 = unchecked((int)0x10a);
|
||||
@@ -112,6 +113,8 @@ namespace Unix.Terminal {
|
||||
public const int KeyF8 = unchecked((int)0x110);
|
||||
public const int KeyF9 = unchecked((int)0x111);
|
||||
public const int KeyF10 = unchecked((int)0x112);
|
||||
public const int KeyF11 = unchecked((int)0x113);
|
||||
public const int KeyF12 = unchecked((int)0x114);
|
||||
public const int KeyResize = unchecked((int)0x19a);
|
||||
public const int ShiftKeyUp = unchecked((int)0x151);
|
||||
public const int ShiftKeyDown = unchecked((int)0x150);
|
||||
|
||||
Reference in New Issue
Block a user