Proposal for fix for enter_pressed on Windows (#1230)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Simon Alibert <75076266+aliberts@users.noreply.github.com>
This commit is contained in:
@@ -233,7 +233,15 @@ def is_valid_numpy_dtype_string(dtype_str: str) -> bool:
|
|||||||
|
|
||||||
|
|
||||||
def enter_pressed() -> bool:
|
def enter_pressed() -> bool:
|
||||||
return select.select([sys.stdin], [], [], 0)[0] and sys.stdin.readline().strip() == ""
|
if platform.system() == "Windows":
|
||||||
|
import msvcrt
|
||||||
|
|
||||||
|
if msvcrt.kbhit():
|
||||||
|
key = msvcrt.getch()
|
||||||
|
return key in (b"\r", b"\n") # enter key
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return select.select([sys.stdin], [], [], 0)[0] and sys.stdin.readline().strip() == ""
|
||||||
|
|
||||||
|
|
||||||
def move_cursor_up(lines):
|
def move_cursor_up(lines):
|
||||||
|
|||||||
Reference in New Issue
Block a user