boon

unix terminal framework
git clone https://git.ce9e.org/boon.git

commit
7ccce164aeeb41cb666a8f0cb826e334fca48d64
parent
1b93b7a71aaef7cf97f25eaf93d0461fa2e95de1
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-07-15 06:28
getch: rm VMIN/VTIME

already set by tty.setcbreak

VMIN is set to 1 though, which changes a few details

Diffstat

M README.md 3 +--
M boon.py 7 +------

2 files changed, 2 insertions, 8 deletions


diff --git a/README.md b/README.md

@@ -114,5 +114,4 @@ Everything is restored to the previous state after the nested block.
  114   114 
  115   115 ### `getch() -> string`
  116   116 
  117    -1 Read from stdin. This is non-blocking. See `App.on_key()` for details on the
  118    -1 return value.
   -1   117 Read from stdin. See `App.on_key()` for details on the return value.

diff --git a/boon.py b/boon.py

@@ -84,12 +84,7 @@ class ReusableFullscreen:
   84    84 def getch():
   85    85     # NOTE: result might contain more than one key
   86    86     fd = sys.stdin.fileno()
   87    -1     with tty_restore(fd):
   88    -1         flags = termios.tcgetattr(fd)
   89    -1         flags[6][termios.VMIN] = 0
   90    -1         flags[6][termios.VTIME] = 0
   91    -1         termios.tcsetattr(fd, termios.TCSADRAIN, flags)
   92    -1         return sys.stdin.read(8)
   -1    87     return os.read(fd, 8).decode('utf-8')
   93    88 
   94    89 
   95    90 class App: