diff options
author | 2017-03-18 13:58:33 -0800 | |
---|---|---|
committer | 2017-03-18 15:07:54 -0700 | |
commit | b089f96e95735d340cbc6cb157541eddfc2b0385 (patch) | |
tree | 4e8e92eadc718cfb9f423ddeb4cf2b727017fc44 /tensorflow/python/debug | |
parent | 11ef7c025fe147c368da8b16b336ceca5a2e3ffb (diff) |
tfdbg: CursesUI: add key mapping for backspace and delete keys
This makes the Backspace and Delete keys work consistently in the Curses-based UI on Linux and Mac.
Previously, for example, Backspace didn't work on some Macs and users had to use Ctrl-H to replace it.
Change: 150542283
Diffstat (limited to 'tensorflow/python/debug')
-rw-r--r-- | tensorflow/python/debug/cli/curses_ui.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tensorflow/python/debug/cli/curses_ui.py b/tensorflow/python/debug/cli/curses_ui.py index 71e2048a96..f1098a1c73 100644 --- a/tensorflow/python/debug/cli/curses_ui.py +++ b/tensorflow/python/debug/cli/curses_ui.py @@ -218,6 +218,11 @@ class CursesUI(base_ui.BaseUI): # num lock is off. CLI_CR_KEYS = [ord("\n"), ord("\r"), 343] + _KEY_MAP = { + 127: 263, # Backspace + 330: 4, # Delete + } + _FOREGROUND_COLORS = { "white": curses.COLOR_WHITE, "red": curses.COLOR_RED, @@ -797,7 +802,7 @@ class CursesUI(base_ui.BaseUI): # Invalidate active command history. self._command_pointer = 0 self._active_command_history = [] - return x + return self._KEY_MAP.get(x, x) def _screen_getmouse(self): return curses.getmouse() |