Browse Source

Added a Key.Tab to Unix. Fixes https://github.com/migueldeicaza/gui.cs/issues/531#issuecomment-633238032

BDisp 5 years ago
parent
commit
f1c6218ad6
2 changed files with 9 additions and 1 deletions
  1. 8 1
      Terminal.Gui/Drivers/CursesDriver.cs
  2. 1 0
      Terminal.Gui/MonoCurses/constants.cs

+ 8 - 1
Terminal.Gui/Drivers/CursesDriver.cs

@@ -148,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;
@@ -420,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;

+ 1 - 0
Terminal.Gui/MonoCurses/constants.cs

@@ -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);