From 4f5af25a0762f0cefaf7880e24c460a246e5fd84 Mon Sep 17 00:00:00 2001 From: vadimkholodilo Date: Fri, 14 Aug 2026 07:49:25 +0300 Subject: [PATCH] Announce capital letters when reviewing by character (fixes #56) --- tdsr/backend/mac.py | 4 +++- tdsr/backend/speechdispatcher.py | 4 ++-- tdsr/tdsr.py | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tdsr/backend/mac.py b/tdsr/backend/mac.py index c60d1f5..8ae6080 100755 --- a/tdsr/backend/mac.py +++ b/tdsr/backend/mac.py @@ -74,9 +74,11 @@ def gotLine(observer, line): def handle_line(line): global rate, volume, voice_idx line = line.decode('utf-8', 'replace') - if line[0] == u"s" or line[0] == "l": + if line[0] == u"s" or line[0] == "l" or line[0] == "L": ln = line[1:].replace('[[', ' ') ln = ln.replace(u'\u23ce', ' ') + if line[0] == "L": + ln = "cap " + ln # macOS 26 doesn't process text in <>, even though we're not telling it to speak SSML. ln = html.escape(ln, False) u = AVSpeechUtterance.alloc().initWithString_(ln) diff --git a/tdsr/backend/speechdispatcher.py b/tdsr/backend/speechdispatcher.py index 7ee9596..0e87638 100755 --- a/tdsr/backend/speechdispatcher.py +++ b/tdsr/backend/speechdispatcher.py @@ -20,9 +20,9 @@ def main(): if line[0] == u"s": synth.speak(line[1:]) elif line[0] == u"l": - # TODO capitals. Do pitchrise here, or just - # let it be Speech Dispatcher's problem? synth.char(line[1:]) + elif line[0] == u"L": + synth.speak("cap " + line[1:]) elif line[0] == u"x": synth.cancel() elif line[0] == u"r": diff --git a/tdsr/tdsr.py b/tdsr/tdsr.py index 70f05ba..edb0bd3 100644 --- a/tdsr/tdsr.py +++ b/tdsr/tdsr.py @@ -739,6 +739,8 @@ def say_character(ch): key = str(ord(ch)) if key in state.config['symbols']: synth.send('s%s\n' % state.config['symbols'][key]) + elif ch.isupper(): + synth.send('L%s\n' % ch) else: synth.send('l%s\n' % ch)