Skip to content

Commit

Permalink
Use UIATextInfo in FORMATTED consoles.
Browse files Browse the repository at this point in the history
  • Loading branch information
codeofdusk committed Jul 22, 2021
1 parent 5407954 commit 4d62b70
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions source/NVDAObjects/UIA/winConsoleUIA.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@


class ConsoleUIATextInfo(UIATextInfo):
"A TextInfo implementation for consoles with an IMPROVED, but not FORMATTED, API level."
def __init__(self, obj, position, _rangeObj=None):
collapseToEnd = None
# We want to limit textInfos to just the visible part of the console.
Expand Down Expand Up @@ -376,11 +377,12 @@ def _get_TextInfo(self):
ConsoleUIATextInfo bounds review to the visible text.
ConsoleUIATextInfoWorkaroundEndInclusive fixes expand/collapse and implements
word movement."""
return (
ConsoleUIATextInfo
if self.apiLevel >= WinConsoleAPILevel.IMPROVED
else ConsoleUIATextInfoWorkaroundEndInclusive
)
if self.apiLevel == WinConsoleAPILevel.FORMATTED:
return UIATextInfo # No TextInfo workarounds needed
elif self.apiLevel == WinConsoleAPILevel.IMPROVED:
return ConsoleUIATextInfo
else:
return ConsoleUIATextInfoWorkaroundEndInclusive

def _get_devInfo(self):
info = super().devInfo
Expand Down Expand Up @@ -408,5 +410,4 @@ def findExtraOverlayClasses(obj, clsList):


class WinTerminalUIA(EnhancedTermTypedCharSupport):
def _get_TextInfo(self):
return ConsoleUIATextInfo
pass

0 comments on commit 4d62b70

Please sign in to comment.