Press tab to resume, not any key

This commit is contained in:
Doman 2022-06-06 20:47:49 +02:00
parent f102912965
commit e9b3223203
6 changed files with 12 additions and 9 deletions

View file

@ -24,14 +24,13 @@ class Application:
action, key = self.listener.listen(screen)
if self.running():
self.buffer.handle_action(action, key)
return True
except StoppingSignal as e:
if e.silent:
self.silent_exit = True
if self.running():
self.buffer.stats.signal_stop()
except:
if self.running():
self.buffer.stats.signal_stop()
return False
def summarize(self):
if self.finished:
@ -40,7 +39,7 @@ class Application:
return False
def exit(self):
if not self.finished and not self.silent_exit:
if not self.silent_exit:
sys.exit(1)

View file

@ -12,7 +12,7 @@ class Config:
"lines_on_screen": 3,
"logo": "~FastTyper~",
"logo_color": 8,
"resume_text": "press any key to continue, <Ctrl>C to exit",
"resume_text": "press <Tab> to continue, <Ctrl>C to exit",
"resume_text_color": 9,
"end_template": (
"wpm: {wpm:.1f}/{peak_wpm:.1f} raw: {raw_wpm:.1f}/{peak_raw_wpm:.1f}",

View file

@ -1,4 +1,5 @@
import curses
from .application import StoppingSignal
class Interface:
@ -54,4 +55,6 @@ class Interface:
screen.clear()
curses.curs_set(0)
self.draw_end(screen)
self.application.action(screen)
while self.application.action(screen):
pass

View file

@ -1,5 +1,6 @@
import enum
import string
import curses
from .application import StoppingSignal
@ -64,5 +65,5 @@ class Listener:
try:
key = screen.get_wch()
return self.handle_key(key)
except KeyboardInterrupt:
except (KeyboardInterrupt, curses.error):
raise StoppingSignal()

View file

@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.1.1
current_version = 2.1.2
[wheel]
universal = 1

View file

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