-
Notifications
You must be signed in to change notification settings - Fork 47
Fix ENTER on macos #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,4 @@ | ||||||
# common | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please import exsiting definitions from other files here
Suggested change
|
||||||
CR = "\x0d" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is alread defined. no need to redefine it |
||||||
ENTER = CR |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,10 @@ def readchar() -> str: | |
term[3] &= ~(termios.ICANON | termios.ECHO | termios.IGNBRK | termios.BRKINT) | ||
termios.tcsetattr(fd, termios.TCSAFLUSH, term) | ||
|
||
ch = sys.stdin.read(1) | ||
if sys.platform == "darwin": | ||
ch = sys.stdin.readline(1) | ||
else: | ||
ch = sys.stdin.read(1) | ||
Comment on lines
+22
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is defnetly to complex for me to just sign of on. Please remove #70 from this PR. I will decide if it makes sense to include it once I finde the time to get around to it. |
||
finally: | ||
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) | ||
return ch | ||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -4,12 +4,11 @@ | |||
|
||||
from . import platform | ||||
|
||||
if ( | ||||
platform.startswith("linux") | ||||
or platform == "darwin" | ||||
or platform.startswith("freebsd") | ||||
): | ||||
if platform.startswith(("linux", "freebsd")): | ||||
from ._posix_key import * | ||||
elif platform.startswith("darwin"): | ||||
from ._posix_key import * | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. like I said above, this should be part of the
Suggested change
|
||||
from ._macos_key import * | ||||
elif platform in ("win32", "cygwin"): | ||||
from ._win_key import * | ||||
else: | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thats a cool idea. very nice.