From a29c3172174c1ac1c5642983670b9ea0dbea4525 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 21 May 2018 22:09:34 +0530 Subject: [PATCH] Add code to disable terminal echo to non_blocking_read --- kitty/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kitty/utils.py b/kitty/utils.py index 329293410..46b5213b9 100644 --- a/kitty/utils.py +++ b/kitty/utils.py @@ -335,7 +335,7 @@ def make_fd_non_blocking(fd): @contextmanager -def non_blocking_read(src=sys.stdin): +def non_blocking_read(src=sys.stdin, disable_echo=False): import termios import tty import fcntl @@ -343,6 +343,10 @@ def non_blocking_read(src=sys.stdin): if src.isatty(): old = termios.tcgetattr(fd) tty.setraw(fd) + if disable_echo: + new = list(old) + new[3] |= termios.ECHO + termios.tcsetattr(fd, termios.TCSANOW, new) oldfl = make_fd_non_blocking(fd) yield fd if src.isatty():