[tor-commits] [nyx/master] Avoid delay when pressing 'esc'

atagar at torproject.org atagar at torproject.org
Sun May 15 19:58:45 UTC 2016


commit b3a051843316561f81ca8a8bcb88c2673f3332f9
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun May 15 12:55:20 2016 -0700

    Avoid delay when pressing 'esc'
    
    Avoiding the small (but very noticeable) delay terminals have by default when
    pressing the 'esc' key. Caught and fix proposed by patacca.
---
 nyx/starter.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/nyx/starter.py b/nyx/starter.py
index 2ddfff0..7162e53 100644
--- a/nyx/starter.py
+++ b/nyx/starter.py
@@ -82,6 +82,7 @@ def main(config):
   _setup_freebsd_chroot(controller)
   _notify_of_unknown_events()
   _use_english_subcommands()
+  _use_no_esc_delay()
   _use_unicode()
   _set_process_name()
 
@@ -224,6 +225,16 @@ def _use_english_subcommands():
   os.putenv('LANG', 'C')
 
 
+def _use_no_esc_delay():
+  """
+  Make it so pressing 'esc' takes effect right away...
+
+    https://stackoverflow.com/questions/27372068/why-does-the-escape-key-have-a-delay-in-python-curses/28020568#28020568
+  """
+
+  os.putenv('ESCDELAY', '0')
+
+
 @uses_settings
 def _use_unicode(config):
   """



More information about the tor-commits mailing list