|
@@ -97,7 +97,7 @@ class MMGenTermLinux(MMGenTerm):
|
|
|
break
|
|
|
|
|
|
@classmethod
|
|
|
- def get_char(cls,prompt='',immed_chars='',prehold_protect=True,num_chars=5):
|
|
|
+ def get_char(cls,prompt='',immed_chars='',prehold_protect=True,num_bytes=5):
|
|
|
"""
|
|
|
Use os.read(), not file.read(), to get a variable number of bytes without blocking.
|
|
|
Request 5 bytes to cover escape sequences generated by F1, F2, .. Fn keys (5 bytes)
|
|
@@ -111,7 +111,7 @@ class MMGenTermLinux(MMGenTerm):
|
|
|
while True:
|
|
|
# Protect against held-down key before read()
|
|
|
key = select([sys.stdin], [], [], timeout)[0]
|
|
|
- s = os.read(cls.stdin_fd,num_chars).decode()
|
|
|
+ s = os.read(cls.stdin_fd,num_bytes).decode()
|
|
|
if prehold_protect and key:
|
|
|
continue
|
|
|
if s in immed_chars:
|
|
@@ -124,10 +124,10 @@ class MMGenTermLinux(MMGenTerm):
|
|
|
return s
|
|
|
|
|
|
@classmethod
|
|
|
- def get_char_raw(cls,prompt='',num_chars=5):
|
|
|
+ def get_char_raw(cls,prompt='',num_bytes=5):
|
|
|
tty.setcbreak(cls.stdin_fd)
|
|
|
msg_r(prompt)
|
|
|
- s = os.read(cls.stdin_fd,num_chars).decode()
|
|
|
+ s = os.read(cls.stdin_fd,num_bytes).decode()
|
|
|
termios.tcsetattr(cls.stdin_fd, termios.TCSADRAIN, cls.old_term)
|
|
|
return s
|
|
|
|
|
@@ -142,7 +142,7 @@ class MMGenTermLinuxStub(MMGenTermLinux):
|
|
|
pass
|
|
|
|
|
|
@classmethod
|
|
|
- def get_char(cls,prompt='',immed_chars='',prehold_protect=None,num_chars=None):
|
|
|
+ def get_char(cls,prompt='',immed_chars='',prehold_protect=None,num_bytes=None):
|
|
|
msg_r(prompt)
|
|
|
return sys.stdin.read(1)
|
|
|
|
|
@@ -190,9 +190,9 @@ class MMGenTermMSWin(MMGenTerm):
|
|
|
return
|
|
|
|
|
|
@classmethod
|
|
|
- def get_char(cls,prompt='',immed_chars='',prehold_protect=True,num_chars=None):
|
|
|
+ def get_char(cls,prompt='',immed_chars='',prehold_protect=True,num_bytes=None):
|
|
|
"""
|
|
|
- always return a single character, ignore num_chars
|
|
|
+ always return a single character, ignore num_bytes
|
|
|
first character of 2-character sequence returned by F1-F12 keys is discarded
|
|
|
prehold_protect is ignored
|
|
|
"""
|
|
@@ -213,9 +213,9 @@ class MMGenTermMSWin(MMGenTerm):
|
|
|
return ch
|
|
|
|
|
|
@classmethod
|
|
|
- def get_char_raw(cls,prompt='',num_chars=None):
|
|
|
+ def get_char_raw(cls,prompt='',num_bytes=None):
|
|
|
"""
|
|
|
- always return a single character, ignore num_chars
|
|
|
+ always return a single character, ignore num_bytes
|
|
|
first character of 2-character sequence returned by F1-F12 keys is discarded
|
|
|
"""
|
|
|
while True:
|
|
@@ -230,7 +230,7 @@ class MMGenTermMSWin(MMGenTerm):
|
|
|
class MMGenTermMSWinStub(MMGenTermMSWin):
|
|
|
|
|
|
@classmethod
|
|
|
- def get_char(cls,prompt='',immed_chars='',prehold_protect=None,num_chars=None):
|
|
|
+ def get_char(cls,prompt='',immed_chars='',prehold_protect=None,num_bytes=None):
|
|
|
msg_r(prompt)
|
|
|
return os.read(0,1).decode()
|
|
|
|