diff --git a/Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs b/Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs index 6b5aa1a1a..0f6b48f5a 100644 --- a/Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs +++ b/Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs @@ -663,7 +663,7 @@ namespace Terminal.Gui { // 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); + Curses.timeout (10); code = Curses.get_wch (out int wch2); @@ -820,6 +820,7 @@ namespace Terminal.Gui { //Console.Out.Flush (); window = Curses.initscr (); + Curses.set_escdelay (10); } catch (Exception e) { throw new Exception ($"Curses failed to initialize, the exception is: {e.Message}"); } diff --git a/Terminal.Gui/ConsoleDrivers/CursesDriver/binding.cs b/Terminal.Gui/ConsoleDrivers/CursesDriver/binding.cs index fa9d49ddd..4195344eb 100644 --- a/Terminal.Gui/ConsoleDrivers/CursesDriver/binding.cs +++ b/Terminal.Gui/ConsoleDrivers/CursesDriver/binding.cs @@ -330,6 +330,7 @@ namespace Unix.Terminal { static public int reset_shell_mode () => methods.reset_shell_mode (); static public int savetty () => methods.savetty (); static public int resetty () => methods.resetty (); + static public int set_escdelay (int size) => methods.set_escdelay (size); } #pragma warning disable RCS1102 // Make class static. @@ -405,6 +406,7 @@ namespace Unix.Terminal { public delegate int reset_shell_mode (); public delegate int savetty (); public delegate int resetty (); + public delegate int set_escdelay (int size); } internal class NativeMethods { @@ -478,6 +480,7 @@ namespace Unix.Terminal { public readonly Delegates.reset_shell_mode reset_shell_mode; public readonly Delegates.savetty savetty; public readonly Delegates.resetty resetty; + public readonly Delegates.set_escdelay set_escdelay; public UnmanagedLibrary UnmanagedLibrary; public NativeMethods (UnmanagedLibrary lib) @@ -553,6 +556,7 @@ namespace Unix.Terminal { reset_shell_mode = lib.GetNativeMethodDelegate ("reset_shell_mode"); savetty = lib.GetNativeMethodDelegate ("savetty"); resetty = lib.GetNativeMethodDelegate ("resetty"); + set_escdelay = lib.GetNativeMethodDelegate ("set_escdelay"); } } #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member