Still attempting to kill off this delay.

This commit is contained in:
Storm Dragon
2026-07-26 21:49:20 -04:00
parent 186512f79a
commit d81565fbf5
2 changed files with 21 additions and 8 deletions
+8 -8
View File
@@ -133,16 +133,16 @@ class OutputManager:
"""
if not text:
return text
# Handle dots at the beginning of words (like .local, .bashrc, .config)
# Look for non-word character (or start of string), dot, then word characters
text = re.sub(r'(?<!\w)\.(\w+)', r'dot \1', text)
# Replace dots that appear between word characters with spoken form
# Use a loop to handle multiple consecutive dots like www.example.com or a.b.c.d
while re.search(r'\b\w+\.\w+\b', text):
text = re.sub(r'\b(\w+)\.(\w+)\b', r'\1 dot \2', text)
text = re.sub(r"(?<!\w)\.(\w+)", r"dot \1", text)
# Replace dots between word characters in one pass. The old loop
# rescanned the full speech string once per remaining dotted word,
# which made large directory listings block the event loop for seconds.
text = re.sub(r"(?<=\w)\.(?=\w)", " dot ", text)
return text
def speak_text(
+13
View File
@@ -178,6 +178,19 @@ def test_present_text_records_speech_history_when_enabled():
speech_driver.speak.assert_called_once()
@pytest.mark.unit
def test_process_mid_word_punctuation_handles_chained_dotted_words():
output_manager, _sound_driver, _speech_driver = build_output_manager()
result = output_manager.process_mid_word_punctuation(
".config archive.tar.gz settings.conf."
)
assert result == (
"dot config archive dot tar dot gz settings dot conf."
)
@pytest.mark.unit
def test_present_text_does_not_record_when_speech_disabled():
output_manager, _sound_driver, speech_driver = build_output_manager()