Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
codeofdusk committed May 31, 2019
1 parent 6083ded commit 768fe0f
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions source/NVDAObjects/UIA/winConsoleUIA.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ def move(self, unit, direction, endPoint=None):
# UIA adds thousands of blank lines to the end of the console.
visiRanges = self.obj.UIATextPattern.GetVisibleRanges()
lastVisiRange = visiRanges.GetElement(visiRanges.length - 1)
if self._rangeObj.CompareEndPoints(UIAHandler.TextPatternRangeEndpoint_Start, lastVisiRange, UIAHandler.TextPatternRangeEndpoint_End) >= 0:
if self._rangeObj.CompareEndPoints(
UIAHandler.TextPatternRangeEndpoint_Start,
lastVisiRange,
UIAHandler.TextPatternRangeEndpoint_End
) >= 0:
return 0
if unit == textInfos.UNIT_WORD and direction != 0:
# UIA doesn't implement word movement, so we need to do it manually.
Expand Down Expand Up @@ -74,10 +78,12 @@ def collapse(self):
self._expandedToWord = False
return super(consoleUIATextInfo, self).collapse()

def getTextWithFields(self,formatConfig=None):
def getTextWithFields(self, formatConfig=None):
if self._expandedToWord:
return [self.text]
return super(consoleUIATextInfo, self).getTextWithFields(formatConfig=formatConfig)
return super(consoleUIATextInfo, self).getTextWithFields(
formatConfig=formatConfig
)

def _get_text(self):
if self._expandedToWord:
Expand Down Expand Up @@ -130,7 +136,7 @@ def _getWordOffsets(self, offset):
)

def _getCurrentWord(self):
lineInfo=self.copy()
lineInfo = self.copy()
lineInfo.expand(textInfos.UNIT_LINE)
lineText = lineInfo.text
offset = self._getCurrentOffset()
Expand All @@ -146,7 +152,10 @@ class winConsoleUIA(Terminal):

def _reportNewText(self, line):
# Additional typed character filtering beyond that in LiveText
if self._isTyping and time.time() - self._lastCharTime <= self._TYPING_TIMEOUT:
if (
self._isTyping
and time.time() - self._lastCharTime <= self._TYPING_TIMEOUT
):
return
super(winConsoleUIA, self)._reportNewText(line)

Expand Down

0 comments on commit 768fe0f

Please sign in to comment.