aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenadha <benawiadha@gmail.com>2021-08-14 21:13:11 +0700
committerbenadha <benawiadha@gmail.com>2021-08-14 21:13:11 +0700
commit55f938c3dcbb91c91f2e9bee01556bf8da97158d (patch)
tree2c86eb4628acba0eb6e704f732794d61a86ca693
parentf0a5af77208d0e551976fe7e15ee9945cc9df4f4 (diff)
downloadepy-55f938c3dcbb91c91f2e9bee01556bf8da97158d.tar.gz
Fixed handling wide character for input promptv2021.8.14
-rwxr-xr-xepy.py12
-rw-r--r--setup.py2
2 files changed, 11 insertions, 3 deletions
diff --git a/epy.py b/epy.py
index ecbc3f9..17a12b2 100755
--- a/epy.py
+++ b/epy.py
@@ -14,7 +14,7 @@ Options:
"""
-__version__ = "2021.7.16"
+__version__ = "2021.8.14"
__license__ = "GPL-3.0"
__author__ = "Benawi Adha"
__email__ = "benawiadha@gmail.com"
@@ -1189,7 +1189,15 @@ def input_prompt(prompt):
try:
while True:
- ipt = stat.getch()
+ # NOTE: getch() only handles ascii
+ # to handle wide char like: é, use get_wch()
+ # ipt = stat.getch()
+ ipt = stat.get_wch()
+ # get_wch() return ambiguous type
+ # str for string input but int for function or special keys
+ if type(ipt) == str:
+ ipt = ord(ipt)
+
if ipt == 27:
stat.clear()
stat.refresh()
diff --git a/setup.py b/setup.py
index ab38914..37ff7ca 100644
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@ if sys.platform == "win32":
setup(
name="epy-reader",
- version="2021.7.16",
+ version="2021.8.14",
description="Terminal/CLI Ebook (epub, fb2, mobi, azw3) Reader",
long_description=long_description,
long_description_content_type="text/markdown",