Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI Automation in Windows Console: remove the isTyping logic from UIA consoles #9673

Merged
merged 4 commits into from
Jun 17, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/liblouis
Submodule liblouis updated 77 files
+0 −3 .gitignore
+1 −3 .travis.yml
+3 −3 .travis/after_success/mingw.sh
+2 −2 .travis/before_install/mingw.sh
+3 −4 .travis/script/mingw.sh
+50 −73 ANNOUNCEMENT
+0 −2 AUTHORS
+1 −1 HACKING
+1 −84 NEWS
+1 −3 README
+24 −24 configure.ac
+21 −21 doc/liblouis.texi
+1 −2 extra/generate-display-names/display-names
+137 −134 liblouis/compileTranslationTable.c
+11 −13 liblouis/internal.h
+9 −9 liblouis/lou_translateString.c
+36 −1 liblouis/pattern.c
+2 −3 tables/Makefile.am
+0 −0 tables/chardefs.cti
+0 −17 tables/de-de-comp8.ctb
+1 −3 tables/en-GB-g2.ctb
+1 −1 tables/en-in-g1.ctb
+401 −444 tables/en-ueb-chardefs.uti
+6 −7 tables/en-ueb-g2.ctb
+75 −118 tables/en-us-comp6.ctb
+97 −0 tables/en-us-compbrl.ctb
+0 −69 tables/en-us-compbrl.uti
+1 −2 tables/en-us-g1.ctb
+1 −1 tables/en-us-interline.ctb
+1 −1 tables/en-us-mathtext.ctb
+2 −1 tables/en_US-comp8-ext.tbl
+1 −1 tables/ethio-g1.ctb
+6 −36 tables/fr-bfu-comp6.utb
+2 −5 tables/hu-hu-comp8.ctb
+1 −7 tables/hu-hu-g1.ctb
+0 −104 tables/hu-hu-g1_braille_input.cti
+0 −2 tables/hu-hu-g2.ctb
+1 −1 tables/ko-2006.cti
+1 −1 tables/ko.cti
+1 −1 tables/mn-MN-common.cti
+84 −54 tables/nl-chardefs.uti
+8 −24 tables/nl-g0.uti
+1 −1 tables/ru-compbrl.ctb
+1 −1 tables/ru-litbrl.ctb
+1 −1 tables/ru-ru-g1.utb
+869 −2,572 tables/zh-tw.ctb
+2 −8 tests/Makefile.am
+3 −5 tests/braille-specs/Makefile.am
+0 −20 tests/braille-specs/de-de-comp8.yaml
+0 −15 tests/braille-specs/en-GB-g2_backward.yaml
+3 −19 tests/braille-specs/en-ueb-g1_harness.yaml
+0 −1 tests/braille-specs/en-ueb-g2-dictionary_harness.yaml
+51 −72 tests/braille-specs/en-ueb-g2_backward.yaml
+0 −66 tests/braille-specs/en-us-comp6.yaml
+1 −1 tests/braille-specs/en-us-g2.yaml
+0 −100 tests/braille-specs/fr-bfu-comp6.yaml
+27 −29 tests/braille-specs/nl-g0_harness.yaml
+0 −435 tests/braille-specs/no_typeform_harness.yaml
+3 −0 tests/braille-specs/spaces.dis
+24 −4 tests/braille-specs/spaces.yaml
+31 −93 tests/braille-specs/ta-ta-g1_harness.yaml
+161 −2,185 tests/braille-specs/zh-tw.yaml
+0 −4 tests/yaml/Makefile.am
+0 −42 tests/yaml/computer_braille.yaml
+1 −1 tests/yaml/emphasis-full.yaml
+1 −1 tests/yaml/emphasis-no-context.yaml
+0 −129 tests/yaml/issue-332.yaml
+0 −2 tests/yaml/issue-332_hyph.dic
+0 −387 tests/yaml/multipass-vs-match.yaml
+5 −5 tests/yaml/multipass.yaml
+1 −19 tools/gnulib/Makefile.am
+1 −2 tools/gnulib/m4/gnulib-cache.m4
+0 −14 tools/gnulib/m4/gnulib-comp.m4
+0 −79 tools/gnulib/m4/realloc.m4
+0 −79 tools/gnulib/realloc.c
+54 −136 tools/lou_checkyaml.c
+1 −1 windows/include/config.h
38 changes: 24 additions & 14 deletions source/NVDAObjects/UIA/winConsoleUIA.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,28 +201,25 @@ def _get_focusRedirect(self):
class winConsoleUIA(Terminal):
STABILIZE_DELAY = 0.03
_TextInfo = consoleUIATextInfo
_isTyping = False
_lastCharTime = 0
_queuedChars = []
_TYPING_TIMEOUT = 1
_hasNewLines = False

def _reportNewText(self, line):
# Additional typed character filtering beyond that in LiveText
if (
self._isTyping
and time.time() - self._lastCharTime <= self._TYPING_TIMEOUT
):
if len(line.strip()) < max(len(speech.curWordChars) + 1, 3):
return
if self._hasNewLines:
# Clear the typed word buffer for new text lines.
# This will need to be changed once #8110 is merged.
speech.curWordChars = []
self._queuedChars = []
super(winConsoleUIA, self)._reportNewText(line)

def event_typedCharacter(self, ch):
if not ch.isspace():
self._isTyping = True
if ch in ('\n', '\r', '\t'):
# Clear the typed word buffer for tab and return.
if ch == '\t':
# Clear the typed word buffer for tab completion.
# This will need to be changed once #8110 is merged.
speech.curWordChars = []
self._lastCharTime = time.time()
if (
(
config.conf['keyboard']['speakTypedCharacters']
Expand All @@ -248,9 +245,12 @@ def event_textChange(self):
"kb:control+d",
"kb:control+pause"
])
def script_clear_isTyping(self, gesture):
def script_flush_queuedChars(self, gesture):
"""
Flushes the queue of typedCharacter events if present.
This is necessary to avoid speaking of passwords in the console if disabled.
"""
gesture.send()
self._isTyping = False
self._queuedChars = []

def _getTextLines(self):
Expand All @@ -259,6 +259,16 @@ def _getTextLines(self):
res = [ptr.GetElement(i).GetText(-1) for i in range(ptr.length)]
return res

def _calculateNewText(self, newLines, oldLines):
self._hasNewLines = (
self._findNonBlankIndices(newLines)
!= self._findNonBlankIndices(oldLines)
)
return super(winConsoleUIA, self)._calculateNewText(newLines, oldLines)

def _findNonBlankIndices(self, lines):
return [index for index, line in enumerate(lines) if line]

def findExtraOverlayClasses(obj, clsList):
if obj.UIAElement.cachedAutomationId == "Text Area":
clsList.append(winConsoleUIA)
Expand Down
2 changes: 1 addition & 1 deletion source/NVDAObjects/behaviors.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def _monitor(self):
newLines = self._getTextLines()
if config.conf["presentation"]["reportDynamicContentChanges"]:
outLines = self._calculateNewText(newLines, oldLines)
if len(outLines) == 1 and len(outLines[0]) == 1:
if len(outLines) == 1 and len(outLines[0].strip()) == 1:
# This is only a single character,
# which probably means it is just a typed character,
# so ignore it.
Expand Down