fix ą character...

This commit is contained in:
Doman 2022-03-18 14:33:13 +01:00
parent 3a9d5a15c8
commit afe232dd59
3 changed files with 19 additions and 8 deletions

View file

@ -20,6 +20,18 @@ class Listener:
def __init__(self, backspace_debug=False):
self.backspace_debug = not backspace_debug
def action_for_char(self, key):
if key == "\t":
raise StoppingSignal(silent=True)
if ord(key) in (8, 127):
return self.action_for_key(ord(key))
if key in string.whitespace:
return Action.add_space
return Action.add_char
def action_for_key(self, key):
if (self.backspace_debug and key == 263) or (
not self.backspace_debug and key == 127
@ -37,17 +49,16 @@ class Listener:
if key in WHITE:
return Action.add_space
return Action.add_char
def handle_key(self, key):
action = Action.invalid
if isinstance(key, str):
key = ord(key)
action = self.action_for_char(key)
else:
action = self.action_for_key(key)
key = chr(key)
action = self.action_for_key(key)
return action, chr(key)
return action, key
def listen(self, screen):
try:

View file

@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.0.2
current_version = 2.0.3
[wheel]
universal = 1

View file

@ -9,7 +9,7 @@ with open("requirements.txt", "r", encoding="utf-8") as fh:
setup(
name="fasttyper",
version="2.0.2",
version="2.0.3",
author="Piotr Domanski",
author_email="pi.domanski@gmail.com",
description="Minimalistic typing exercise",