File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99import os
1010import codecs
1111import api
12- import config
1312from . import dictFormatUpgrade
1413from .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+
118121def 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
You can’t perform that action at this time.
0 commit comments