Skip to content

Commit

Permalink
Add NOTIFYING API level for future work/debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
codeofdusk committed Feb 4, 2022
1 parent 08ffe3f commit 8812a1d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions source/UIAHandler/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,6 @@ class WinConsoleAPILevel(enum.IntEnum):
# Represents an IMPROVED console that exposes text formatting and a
# buffer that does not contain extraneous empty lines.
FORMATTED = 2
# Represents a console that sends UIA notification events for new text,
# making NVDAObjects.behaviors.LiveText unnecessary.
NOTIFYING = 3
10 changes: 10 additions & 0 deletions source/UIAHandler/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,16 @@ def _getConhostAPILevel(hwnd: int) -> WinConsoleAPILevel:
textArea = UIAElement.buildUpdatedCache(
textAreaCacheRequest
).getCachedChildren().GetElement(0)
if (
textArea.getCurrentPropertyValueEx(
UIAHandler.UIA.UIA_LiveSettingPropertyId,
False
)
== UIAHandler.UIA.Polite
):
# microsoft/terminal#12358: modern consoles send UIA notification
# events for new text.
return WinConsoleAPILevel.NOTIFYING
UIATextPattern = textArea.GetCurrentPattern(
UIAHandler.UIA_TextPatternId
).QueryInterface(UIAHandler.IUIAutomationTextPattern)
Expand Down

0 comments on commit 8812a1d

Please sign in to comment.