mirror of
https://github.com/paul-nameless/tg
synced 2024-11-22 03:43:19 +00:00
Add support for Cyrillic characters in get_keys()
This commit is contained in:
parent
790a06cf2b
commit
d8d559a6e9
1 changed files with 13 additions and 9 deletions
22
tg/views.py
22
tg/views.py
|
@ -91,15 +91,19 @@ class View:
|
||||||
|
|
||||||
for _ in range(MAX_KEYBINDING_LENGTH):
|
for _ in range(MAX_KEYBINDING_LENGTH):
|
||||||
ch = self.stdscr.getch()
|
ch = self.stdscr.getch()
|
||||||
log.info("raw ch without unctrl: %s", ch)
|
if ch == 208 or ch == 209:
|
||||||
try:
|
second_ch = self.stdscr.getch()
|
||||||
key = curses.unctrl(ch).decode()
|
key = (ch.to_bytes() + second_ch.to_bytes()).decode('utf-8')
|
||||||
except Exception:
|
else:
|
||||||
log.warning("cant uncrtl: %s", ch)
|
log.info("raw ch without unctrl: %s", ch)
|
||||||
break
|
try:
|
||||||
if key.isdigit():
|
key = curses.unctrl(ch).decode()
|
||||||
repeat_factor += key
|
except Exception:
|
||||||
continue
|
log.warning("cant uncrtl: %s", ch)
|
||||||
|
break
|
||||||
|
if key.isdigit():
|
||||||
|
repeat_factor += key
|
||||||
|
continue
|
||||||
keys += key
|
keys += key
|
||||||
# if match found or there are not any shortcut matches at all
|
# if match found or there are not any shortcut matches at all
|
||||||
if all(
|
if all(
|
||||||
|
|
Loading…
Reference in a new issue