Still attempting to kill off this delay.
This commit is contained in:
@@ -136,12 +136,12 @@ class OutputManager:
|
|||||||
|
|
||||||
# Handle dots at the beginning of words (like .local, .bashrc, .config)
|
# Handle dots at the beginning of words (like .local, .bashrc, .config)
|
||||||
# Look for non-word character (or start of string), dot, then word characters
|
# Look for non-word character (or start of string), dot, then word characters
|
||||||
text = re.sub(r'(?<!\w)\.(\w+)', r'dot \1', text)
|
text = re.sub(r"(?<!\w)\.(\w+)", r"dot \1", text)
|
||||||
|
|
||||||
# Replace dots that appear between word characters with spoken form
|
# Replace dots between word characters in one pass. The old loop
|
||||||
# Use a loop to handle multiple consecutive dots like www.example.com or a.b.c.d
|
# rescanned the full speech string once per remaining dotted word,
|
||||||
while re.search(r'\b\w+\.\w+\b', text):
|
# which made large directory listings block the event loop for seconds.
|
||||||
text = re.sub(r'\b(\w+)\.(\w+)\b', r'\1 dot \2', text)
|
text = re.sub(r"(?<=\w)\.(?=\w)", " dot ", text)
|
||||||
|
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|||||||
@@ -178,6 +178,19 @@ def test_present_text_records_speech_history_when_enabled():
|
|||||||
speech_driver.speak.assert_called_once()
|
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
|
@pytest.mark.unit
|
||||||
def test_present_text_does_not_record_when_speech_disabled():
|
def test_present_text_does_not_record_when_speech_disabled():
|
||||||
output_manager, _sound_driver, speech_driver = build_output_manager()
|
output_manager, _sound_driver, speech_driver = build_output_manager()
|
||||||
|
|||||||
Reference in New Issue
Block a user