Skip to content

Commit 5900fdb

Browse files
authored
Merge 306970b into 9958841
2 parents 9958841 + 306970b commit 5900fdb

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

source/speechDictHandler/__init__.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import os
1010
import codecs
1111
import api
12-
import config
1312
from . import dictFormatUpgrade
1413
from .speechDictVars import speechDictsPath
1514

@@ -115,9 +114,22 @@ def sub(self, text):
115114
del self[index]
116115
return text
117116

117+
118+
# useful for #14689 (see below)
119+
IGNORE_TRAILING_WHITESPACE_LENGTH = 100
120+
118121
def processText(text):
119122
if not globalVars.speechDictionaryProcessing:
120123
return text
124+
# #14689: API level < 2 UIA consoles have many blank lines, which slows processing to a halt
125+
# Because from UIAHandler.constants import WinConsoleAPILevel
126+
# cause crashes as global import, and probably slowdowns here
127+
# use 2 instead of WinConsoleAPILevel.FORMATTED constant
128+
focus = api.getFocusObject()
129+
if hasattr(focus, "apiLevel") and focus.apiLevel < 2:
130+
stripText = text.rstrip()
131+
if len(text) - len(stripText) > IGNORE_TRAILING_WHITESPACE_LENGTH:
132+
text = stripText
121133
for type in dictTypes:
122134
text=dictionaries[type].sub(text)
123135
return text

0 commit comments

Comments
 (0)