// Key handling /// <summary> /// This method can be overwritten by view that /// want to provide accelerator functionality /// (Alt-key for example). /// </summary> /// <remarks> /// <para> /// Before keys are sent to the subview on the /// current view, all the views are /// processed and the key is passed to the widgets /// to allow some of them to process the keystroke /// as a hot-key. </para> /// <para> /// For example, if you implement a button that /// has a hotkey ok "o", you would catch the /// combination Alt-o here. If the event is /// caught, you must return true to stop the /// keystroke from being dispatched to other /// views. /// </para> /// </remarks> public virtual bool ProcessHotKey(KeyEvent kb) { return(false); }
void ProcessInput(Action <KeyEvent> keyHandler, Action <KeyEvent> keyDownHandler, Action <KeyEvent> keyUpHandler, Action <MouseEvent> mouseHandler) { int wch; var code = Curses.get_wch(out wch); if (code == Curses.ERR) { return; } keyModifiers = new KeyModifiers(); Key k = Key.Null; if (code == Curses.KEY_CODE_YES) { if (wch == Curses.KeyResize) { if (Curses.CheckWinChange()) { TerminalResized?.Invoke(); return; } } if (wch == Curses.KeyMouse) { Curses.getmouse(out Curses.MouseEvent ev); //System.Diagnostics.Debug.WriteLine ($"ButtonState: {ev.ButtonState}; ID: {ev.ID}; X: {ev.X}; Y: {ev.Y}; Z: {ev.Z}"); mouseHandler(ToDriverMouse(ev)); return; } k = MapCursesKey(wch); if (wch >= 277 && wch <= 288) // Shift+(F1 - F12) { wch -= 12; k = Key.ShiftMask | MapCursesKey(wch); } else if (wch >= 289 && wch <= 300) // Ctrl+(F1 - F12) { wch -= 24; k = Key.CtrlMask | MapCursesKey(wch); } else if (wch >= 301 && wch <= 312) // Ctrl+Shift+(F1 - F12) { wch -= 36; k = Key.CtrlMask | Key.ShiftMask | MapCursesKey(wch); } else if (wch >= 313 && wch <= 324) // Alt+(F1 - F12) { wch -= 48; k = Key.AltMask | MapCursesKey(wch); } else if (wch >= 325 && wch <= 327) // Shift+Alt+(F1 - F3) { wch -= 60; k = Key.ShiftMask | Key.AltMask | MapCursesKey(wch); } keyDownHandler(new KeyEvent(k, MapKeyModifiers(k))); keyHandler(new KeyEvent(k, MapKeyModifiers(k))); keyUpHandler(new KeyEvent(k, MapKeyModifiers(k))); return; } // Special handling for ESC, we want to try to catch ESC+letter to simulate alt-letter as well as Alt-Fkey if (wch == 27) { Curses.timeout(200); code = Curses.get_wch(out int wch2); if (code == Curses.KEY_CODE_YES) { k = Key.AltMask | MapCursesKey(wch); } if (code == 0) { KeyEvent key; // The ESC-number handling, debatable. // Simulates the AltMask itself by pressing Alt + Space. if (wch2 == (int)Key.Space) { k = Key.AltMask; } else if (wch2 - (int)Key.Space >= (uint)Key.A && wch2 - (int)Key.Space <= (uint)Key.Z) { k = (Key)((uint)Key.AltMask + (wch2 - (int)Key.Space)); } else if (wch2 >= (uint)Key.A - 64 && wch2 <= (uint)Key.Z - 64) { k = (Key)((uint)(Key.AltMask | Key.CtrlMask) + (wch2 + 64)); } else if (wch2 >= (uint)Key.D0 && wch2 <= (uint)Key.D9) { k = (Key)((uint)Key.AltMask + (uint)Key.D0 + (wch2 - (uint)Key.D0)); } else if (wch2 == 27) { k = (Key)wch2; } else if (wch2 == Curses.KEY_CODE_SEQ) { int [] c = null; while (code == 0) { code = Curses.get_wch(out wch2); if (wch2 > 0) { Array.Resize(ref c, c == null ? 1 : c.Length + 1); c [c.Length - 1] = wch2; } } if (c [0] == 49 && c [1] == 59 && c [2] == 55 && c [3] >= 80 && c [3] <= 83) // Ctrl+Alt+(F1 - F4) { wch2 = c [3] + 185; k = Key.CtrlMask | Key.AltMask | MapCursesKey(wch2); } else if (c [0] == 49 && c [2] == 59 && c [3] == 55 && c [4] == 126 && c [1] >= 53 && c [1] <= 57) // Ctrl+Alt+(F5 - F8) { wch2 = c [1] == 53 ? c [1] + 216 : c [1] + 215; k = Key.CtrlMask | Key.AltMask | MapCursesKey(wch2); } else if (c [0] == 50 && c [2] == 59 && c [3] == 55 && c [4] == 126 && c [1] >= 48 && c [1] <= 52) // Ctrl+Alt+(F9 - F12) { wch2 = c [1] < 51 ? c [1] + 225 : c [1] + 224; k = Key.CtrlMask | Key.AltMask | MapCursesKey(wch2); } else if (c [0] == 49 && c [1] == 59 && c [2] == 56 && c [3] >= 80 && c [3] <= 83) // Ctrl+Shift+Alt+(F1 - F4) { wch2 = c [3] + 185; k = Key.CtrlMask | Key.ShiftMask | Key.AltMask | MapCursesKey(wch2); } else if (c [0] == 49 && c [2] == 59 && c [3] == 56 && c [4] == 126 && c [1] >= 53 && c [1] <= 57) // Ctrl+Shift+Alt+(F5 - F8) { wch2 = c [1] == 53 ? c [1] + 216 : c [1] + 215; k = Key.CtrlMask | Key.ShiftMask | Key.AltMask | MapCursesKey(wch2); } else if (c [0] == 50 && c [2] == 59 && c [3] == 56 && c [4] == 126 && c [1] >= 48 && c [1] <= 52) // Ctrl+Shift+Alt+(F9 - F12) { wch2 = c [1] < 51 ? c [1] + 225 : c [1] + 224; k = Key.CtrlMask | Key.ShiftMask | Key.AltMask | MapCursesKey(wch2); } else if (c [0] == 49 && c [1] == 59 && c [2] == 52 && c [3] == 83) // Shift+Alt+(F4) { wch2 = 268; k = Key.ShiftMask | Key.AltMask | MapCursesKey(wch2); } else if (c [0] == 49 && c [2] == 59 && c [3] == 52 && c [4] == 126 && c [1] >= 53 && c [1] <= 57) // Shift+Alt+(F5 - F8) { wch2 = c [1] < 55 ? c [1] + 216 : c [1] + 215; k = Key.ShiftMask | Key.AltMask | MapCursesKey(wch2); } else if (c [0] == 50 && c [2] == 59 && c [3] == 52 && c [4] == 126 && c [1] >= 48 && c [1] <= 52) // Shift+Alt+(F9 - F12) { wch2 = c [1] < 51 ? c [1] + 225 : c [1] + 224; k = Key.ShiftMask | Key.AltMask | MapCursesKey(wch2); } else if (c [0] == 54 && c [1] == 59 && c [2] == 56 && c [3] == 126) // Shift+Ctrl+Alt+KeyNPage { k = Key.ShiftMask | Key.CtrlMask | Key.AltMask | Key.PageDown; } else if (c [0] == 53 && c [1] == 59 && c [2] == 56 && c [3] == 126) // Shift+Ctrl+Alt+KeyPPage { k = Key.ShiftMask | Key.CtrlMask | Key.AltMask | Key.PageUp; } else if (c [0] == 49 && c [1] == 59 && c [2] == 56 && c [3] == 72) // Shift+Ctrl+Alt+KeyHome { k = Key.ShiftMask | Key.CtrlMask | Key.AltMask | Key.Home; } else if (c [0] == 49 && c [1] == 59 && c [2] == 56 && c [3] == 70) // Shift+Ctrl+Alt+KeyEnd { k = Key.ShiftMask | Key.CtrlMask | Key.AltMask | Key.End; } else { k = MapCursesKey(wch2); } } else { // Unfortunately there are no way to differentiate Ctrl+Alt+alfa and Ctrl+Shift+Alt+alfa. if (((Key)wch2 & Key.CtrlMask) != 0) { keyModifiers.Ctrl = true; } if (wch2 == 0) { k = Key.CtrlMask | Key.AltMask | Key.Space; } else if (wch >= (uint)Key.A && wch <= (uint)Key.Z) { keyModifiers.Shift = true; keyModifiers.Alt = true; } else if (wch2 < 256) { k = (Key)wch2; keyModifiers.Alt = true; } else { k = (Key)((uint)(Key.AltMask | Key.CtrlMask) + wch2); } } key = new KeyEvent(k, MapKeyModifiers(k)); keyDownHandler(key); keyHandler(key); } else { k = Key.Esc; keyHandler(new KeyEvent(k, MapKeyModifiers(k))); } } else if (wch == Curses.KeyTab) { k = MapCursesKey(wch); keyDownHandler(new KeyEvent(k, MapKeyModifiers(k))); keyHandler(new KeyEvent(k, MapKeyModifiers(k))); } else { // Unfortunately there are no way to differentiate Ctrl+alfa and Ctrl+Shift+alfa. k = (Key)wch; if (wch == 0) { k = Key.CtrlMask | Key.Space; } else if (wch >= (uint)Key.A - 64 && wch <= (uint)Key.Z - 64) { if ((Key)(wch + 64) != Key.J) { k = Key.CtrlMask | (Key)(wch + 64); } } else if (wch >= (uint)Key.A && wch <= (uint)Key.Z) { keyModifiers.Shift = true; } keyDownHandler(new KeyEvent(k, MapKeyModifiers(k))); keyHandler(new KeyEvent(k, MapKeyModifiers(k))); keyUpHandler(new KeyEvent(k, MapKeyModifiers(k))); } // Cause OnKeyUp and OnKeyPressed. Note that the special handling for ESC above // will not impact KeyUp. // This is causing ESC firing even if another keystroke was handled. //if (wch == Curses.KeyTab) { // keyUpHandler (new KeyEvent (MapCursesKey (wch), keyModifiers)); //} else { // keyUpHandler (new KeyEvent ((Key)wch, keyModifiers)); //} }
/// <summary> /// This method can be overwritten by views that /// want to provide accelerator functionality /// (Alt-key for example), but without /// interefering with normal ProcessKey behavior. /// </summary> /// <remarks> /// <para> /// After keys are sent to the subviews on the /// current view, all the view are /// processed and the key is passed to the views /// to allow some of them to process the keystroke /// as a cold-key. </para> /// <para> /// This functionality is used, for example, by /// default buttons to act on the enter key. /// Processing this as a hot-key would prevent /// non-default buttons from consuming the enter /// keypress when they have the focus. /// </para> /// </remarks> /// <param name="keyEvent">Contains the details about the key that produced the event.</param> public virtual bool ProcessColdKey(KeyEvent keyEvent) { return(false); }
/// <summary> /// Method invoked when a key is released. /// </summary> /// <param name="keyEvent">Contains the details about the key that produced the event.</param> /// <returns>true if the event was handled</returns> public virtual bool OnKeyUp(KeyEvent keyEvent) { return(false); }
void ProcessInput(Action <KeyEvent> keyHandler, Action <KeyEvent> keyDownHandler, Action <KeyEvent> keyUpHandler, Action <MouseEvent> mouseHandler) { int wch; var code = Curses.get_wch(out wch); if (code == Curses.ERR) { return; } keyModifiers = new KeyModifiers(); Key k; if (code == Curses.KEY_CODE_YES) { if (wch == Curses.KeyResize) { if (Curses.CheckWinChange()) { TerminalResized?.Invoke(); return; } } if (wch == Curses.KeyMouse) { Curses.getmouse(out Curses.MouseEvent ev); //System.Diagnostics.Debug.WriteLine ($"ButtonState: {ev.ButtonState}; ID: {ev.ID}; X: {ev.X}; Y: {ev.Y}; Z: {ev.Z}"); mouseHandler(ToDriverMouse(ev)); return; } keyHandler(new KeyEvent(MapCursesKey(wch), keyModifiers)); keyUpHandler(new KeyEvent(MapCursesKey(wch), keyModifiers)); return; } // Special handling for ESC, we want to try to catch ESC+letter to simulate alt-letter as well as Alt-Fkey if (wch == 27) { Curses.timeout(200); code = Curses.get_wch(out int wch2); if (code == Curses.KEY_CODE_YES) { k = Key.AltMask | MapCursesKey(wch); keyHandler(new KeyEvent(k, MapKeyModifiers(k))); } if (code == 0) { KeyEvent key; // The ESC-number handling, debatable. // Simulates the AltMask itself by pressing Alt + Space. if (wch2 == (int)Key.Space) { k = Key.AltMask; key = new KeyEvent(k, MapKeyModifiers(k)); } else if (wch2 - (int)Key.Space >= 'A' && wch2 - (int)Key.Space <= 'Z') { k = (Key)((uint)Key.AltMask + (wch2 - (int)Key.Space)); key = new KeyEvent(k, MapKeyModifiers(k)); } else if (wch2 >= '1' && wch <= '9') { k = (Key)((int)Key.F1 + (wch2 - '0' - 1)); key = new KeyEvent(k, MapKeyModifiers(k)); } else if (wch2 == '0') { k = Key.F10; key = new KeyEvent(k, MapKeyModifiers(k)); } else if (wch2 == 27) { k = (Key)wch2; key = new KeyEvent(k, MapKeyModifiers(k)); } else { k = Key.AltMask | (Key)wch2; key = new KeyEvent(k, MapKeyModifiers(k)); } keyHandler(key); } else { k = Key.Esc; keyHandler(new KeyEvent(k, MapKeyModifiers(k))); } } else if (wch == Curses.KeyTab) { k = MapCursesKey(wch); keyDownHandler(new KeyEvent(k, MapKeyModifiers(k))); keyHandler(new KeyEvent(k, MapKeyModifiers(k))); } else { k = (Key)wch; keyDownHandler(new KeyEvent(k, MapKeyModifiers(k))); keyHandler(new KeyEvent(k, MapKeyModifiers(k))); } // Cause OnKeyUp and OnKeyPressed. Note that the special handling for ESC above // will not impact KeyUp. // This is causing ESC firing even if another keystroke was handled. //if (wch == Curses.KeyTab) { // keyUpHandler (new KeyEvent (MapCursesKey (wch), keyModifiers)); //} else { // keyUpHandler (new KeyEvent ((Key)wch, keyModifiers)); //} }
///<inheritdoc/> public override bool ProcessKey(KeyEvent keyEvent) { if (base.ProcessKey(keyEvent)) { return(true); } switch (keyEvent.Key) { case Key.ControlQ: // FIXED: stop current execution of this container Application.RequestStop(); break; case Key.ControlZ: Driver.Suspend(); return(true); #if false case Key.F5: Application.DebugDrawBounds = !Application.DebugDrawBounds; SetNeedsDisplay(); return(true); #endif case Key.Tab: case Key.CursorRight: case Key.CursorDown: case Key.ControlI: // Unix var old = Focused; if (!FocusNext()) { FocusNext(); } if (old != Focused) { old?.SetNeedsDisplay(); Focused?.SetNeedsDisplay(); } else { FocusNearestView(GetToplevelSubviews(true)); } return(true); case Key.CursorLeft: case Key.CursorUp: case Key.BackTab: old = Focused; if (!FocusPrev()) { FocusPrev(); } if (old != Focused) { old?.SetNeedsDisplay(); Focused?.SetNeedsDisplay(); } else { FocusNearestView(GetToplevelSubviews(false)); } return(true); case Key.ControlL: Application.Refresh(); return(true); } return(false); }
void ProcessInput(Action <KeyEvent> keyHandler, Action <MouseEvent> mouseHandler) { int wch; var code = Curses.get_wch(out wch); if (code == Curses.ERR) { return; } if (code == Curses.KEY_CODE_YES) { if (wch == Curses.KeyResize) { if (Curses.CheckWinChange()) { terminalResized(); return; } } if (wch == Curses.KeyMouse) { Curses.MouseEvent ev; Curses.getmouse(out ev); mouseHandler(ToDriverMouse(ev)); return; } keyHandler(new KeyEvent(MapCursesKey(wch))); return; } // Special handling for ESC, we want to try to catch ESC+letter to simulate alt-letter as well as Alt-Fkey if (wch == 27) { Curses.timeout(200); code = Curses.get_wch(out wch); if (code == Curses.KEY_CODE_YES) { keyHandler(new KeyEvent(Key.AltMask | MapCursesKey(wch))); } if (code == 0) { KeyEvent key; // The ESC-number handling, debatable. if (wch >= '1' && wch <= '9') { key = new KeyEvent((Key)((int)Key.F1 + (wch - '0' - 1))); } else if (wch == '0') { key = new KeyEvent(Key.F10); } else if (wch == 27) { key = new KeyEvent((Key)wch); } else { key = new KeyEvent(Key.AltMask | (Key)wch); } keyHandler(key); } else { keyHandler(new KeyEvent(Key.Esc)); } } else { keyHandler(new KeyEvent((Key)wch)); } }
///<inheritdoc/> public override bool ProcessKey(KeyEvent keyEvent) { if (base.ProcessKey(keyEvent)) { return(true); } switch (ShortcutHelper.GetModifiersKey(keyEvent)) { case Key k when k == Application.QuitKey: // FIXED: stop current execution of this container if (Application.MdiTop != null) { Application.MdiTop.RequestStop(); } else { Application.RequestStop(); } break; case Key.Z | Key.CtrlMask: Driver.Suspend(); return(true); #if false case Key.F5: Application.DebugDrawBounds = !Application.DebugDrawBounds; SetNeedsDisplay(); return(true); #endif case Key.Tab: case Key.CursorRight: case Key.CursorDown: case Key.I | Key.CtrlMask: // Unix var old = GetDeepestFocusedSubview(Focused); if (!FocusNext()) { FocusNext(); } if (old != Focused && old != Focused?.Focused) { old?.SetNeedsDisplay(); Focused?.SetNeedsDisplay(); } else { FocusNearestView(SuperView?.TabIndexes, Direction.Forward); } return(true); case Key.BackTab | Key.ShiftMask: case Key.CursorLeft: case Key.CursorUp: old = GetDeepestFocusedSubview(Focused); if (!FocusPrev()) { FocusPrev(); } if (old != Focused && old != Focused?.Focused) { old?.SetNeedsDisplay(); Focused?.SetNeedsDisplay(); } else { FocusNearestView(SuperView?.TabIndexes?.Reverse(), Direction.Backward); } return(true); case Key.Tab | Key.CtrlMask: case Key key when key == Application.AlternateForwardKey: // Needed on Unix if (Application.MdiTop == null) { var top = Modal ? this : Application.Top; top.FocusNext(); if (top.Focused == null) { top.FocusNext(); } top.SetNeedsDisplay(); } else { MoveNext(); } return(true); case Key.Tab | Key.ShiftMask | Key.CtrlMask: case Key key when key == Application.AlternateBackwardKey: // Needed on Unix if (Application.MdiTop == null) { var top = Modal ? this : Application.Top; top.FocusPrev(); if (top.Focused == null) { top.FocusPrev(); } top.SetNeedsDisplay(); } else { MovePrevious(); } return(true); case Key.L | Key.CtrlMask: Application.Refresh(); return(true); } return(false); }
///<inheritdoc/> public override bool ProcessKey(KeyEvent e) { if (e.Key == Key.Tab) { base.ProcessKey(e); return(false); // allow tab-out to next control } if (e.Key == Key.Enter && listview.HasFocus) { if (listview.Source.Count == 0 || searchset.Count == 0) { text = ""; return(true); } SetValue(searchset [listview.SelectedItem]); search.CursorPosition = search.Text.Length; Search_Changed(search, search.Text); Changed?.Invoke(this, text); searchset.Clear(); listview.Clear(); listview.Height = 0; this.SetFocus(search); return(true); } if (e.Key == Key.CursorDown && search.HasFocus && listview.SelectedItem == 0 && searchset.Count > 0) // jump to list { this.SetFocus(listview); SetValue(searchset [listview.SelectedItem]); return(true); } if (e.Key == Key.CursorUp && search.HasFocus) // stop odd behavior on KeyUp when search has focus { return(true); } if (e.Key == Key.CursorUp && listview.HasFocus && listview.SelectedItem == 0 && searchset.Count > 0) // jump back to search { search.CursorPosition = search.Text.Length; this.SetFocus(search); return(true); } if (e.Key == Key.Esc) { this.SetFocus(search); search.Text = text = ""; Changed?.Invoke(this, search.Text); return(true); } // Unix emulation if (e.Key == Key.ControlU) { Reset(); return(true); } return(base.ProcessKey(e)); }
void ProcessInput(Action <KeyEvent> keyHandler, Action <KeyEvent> keyDownHandler, Action <KeyEvent> keyUpHandler, Action <MouseEvent> mouseHandler) { int wch; var code = Curses.get_wch(out wch); if (code == Curses.ERR) { return; } keyModifiers = new KeyModifiers(); Key k; if (code == Curses.KEY_CODE_YES) { if (wch == Curses.KeyResize) { if (Curses.CheckWinChange()) { TerminalResized?.Invoke(); return; } } if (wch == Curses.KeyMouse) { Curses.MouseEvent ev; Curses.getmouse(out ev); mouseHandler(ToDriverMouse(ev)); return; } keyHandler(new KeyEvent(MapCursesKey(wch), keyModifiers)); keyUpHandler(new KeyEvent(MapCursesKey(wch), keyModifiers)); return; } // Special handling for ESC, we want to try to catch ESC+letter to simulate alt-letter as well as Alt-Fkey if (wch == 27) { Curses.timeout(10); code = Curses.get_wch(out int wch2); if (code == Curses.KEY_CODE_YES) { k = Key.AltMask | MapCursesKey(wch); keyHandler(new KeyEvent(k, MapKeyModifiers(k))); } if (code == 0) { KeyEvent key; // The ESC-number handling, debatable. // Simulates the AltMask itself by pressing Alt + Space. if (wch2 == (int)Key.Space) { k = Key.AltMask; key = new KeyEvent(k, MapKeyModifiers(k)); } else if (wch2 - (int)Key.Space >= 'A' && wch2 - (int)Key.Space <= 'Z') { k = (Key)((uint)Key.AltMask + (wch2 - (int)Key.Space)); key = new KeyEvent(k, MapKeyModifiers(k)); } else if (wch2 >= '1' && wch <= '9') { k = (Key)((int)Key.F1 + (wch2 - '0' - 1)); key = new KeyEvent(k, MapKeyModifiers(k)); } else if (wch2 == '0') { k = Key.F10; key = new KeyEvent(k, MapKeyModifiers(k)); } else if (wch2 == 27) { k = (Key)wch2; key = new KeyEvent(k, MapKeyModifiers(k)); } else { k = Key.AltMask | (Key)wch2; key = new KeyEvent(k, MapKeyModifiers(k)); } keyHandler(key); } else { k = Key.Esc; keyHandler(new KeyEvent(k, MapKeyModifiers(k))); } } else if (wch == Curses.KeyTab) { k = MapCursesKey(wch); keyDownHandler(new KeyEvent(k, MapKeyModifiers(k))); keyHandler(new KeyEvent(k, MapKeyModifiers(k))); } else { k = (Key)wch; // In linux terminals, ControlH and ctrl+backspace send the same keycode if (k == Key.ControlH) { if (keyModifiers == null) { keyModifiers = new KeyModifiers(); } keyModifiers.Ctrl = true; k = Key.Backspace; } keyDownHandler(new KeyEvent(k, MapKeyModifiers(k))); keyHandler(new KeyEvent(k, MapKeyModifiers(k))); } // Cause OnKeyUp and OnKeyPressed. Note that the special handling for ESC above // will not impact KeyUp. // This is causing ESC firing even if another keystroke was handled. //if (wch == Curses.KeyTab) { // keyUpHandler (new KeyEvent (MapCursesKey (wch), keyModifiers)); //} else { // keyUpHandler (new KeyEvent ((Key)wch, keyModifiers)); //} }
void IMainLoopDriver.MainIteration() { if (result == null) { return; } var inputEvent = result [0]; switch (inputEvent.EventType) { case WindowsConsole.EventType.Key: var map = MapKey(ToConsoleKeyInfoEx(inputEvent.KeyEvent)); if (map == (Key)0xffffffff) { KeyEvent key; // Shift = VK_SHIFT = 0x10 // Ctrl = VK_CONTROL = 0x11 // Alt = VK_MENU = 0x12 switch (inputEvent.KeyEvent.wVirtualKeyCode) { case 0x11: key = new KeyEvent(Key.CtrlMask); break; case 0x12: key = new KeyEvent(Key.AltMask); break; default: key = new KeyEvent(Key.Unknown); break; } if (inputEvent.KeyEvent.bKeyDown) { keyDownHandler(key); } else { keyUpHandler(key); } } else { if (inputEvent.KeyEvent.bKeyDown) { // Key Down - Fire KeyDown Event and KeyStroke (ProcessKey) Event keyDownHandler(new KeyEvent(map)); keyHandler(new KeyEvent(map)); } else { keyUpHandler(new KeyEvent(map)); } } break; case WindowsConsole.EventType.Mouse: mouseHandler(ToDriverMouse(inputEvent.MouseEvent)); if (IsButtonReleased) { mouseHandler(ToDriverMouse(inputEvent.MouseEvent)); } break; case WindowsConsole.EventType.WindowBufferSize: cols = inputEvent.WindowBufferSizeEvent.size.X; rows = inputEvent.WindowBufferSizeEvent.size.Y; ResizeScreen(); UpdateOffScreen(); TerminalResized?.Invoke(); break; } result = null; }