Repeat hold message on ctrl+c/d instead of completely ignoring or ending hold
This commit is contained in:
parent
436ef0074a
commit
dbbabd73c5
@ -892,7 +892,8 @@ def hold_till_enter() -> None:
|
|||||||
|
|
||||||
from kittens.tui.operations import init_state, set_cursor_visible
|
from kittens.tui.operations import init_state, set_cursor_visible
|
||||||
fd, original_termios = open_tty()
|
fd, original_termios = open_tty()
|
||||||
write_all(fd, '\n\x1b[1;32mPress Enter or Esc to exit')
|
msg = '\n\r\x1b[1;32mPress Enter or Esc to exit'
|
||||||
|
write_all(fd, msg)
|
||||||
write_all(fd, init_state(alternate_screen=False, kitty_keyboard_mode=False) + set_cursor_visible(False))
|
write_all(fd, init_state(alternate_screen=False, kitty_keyboard_mode=False) + set_cursor_visible(False))
|
||||||
with no_echo(fd):
|
with no_echo(fd):
|
||||||
termios.tcdrain(fd)
|
termios.tcdrain(fd)
|
||||||
@ -901,5 +902,7 @@ def hold_till_enter() -> None:
|
|||||||
if not rd:
|
if not rd:
|
||||||
break
|
break
|
||||||
q = os.read(fd, 1)
|
q = os.read(fd, 1)
|
||||||
if q in b'\n\r\x1b\x03':
|
if q in b'\n\r\x1b':
|
||||||
break
|
break
|
||||||
|
if q in b'\x03\x04':
|
||||||
|
write_all(fd, msg)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user