-
-
Notifications
You must be signed in to change notification settings - Fork 631
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
Prototype for Windows Terminal: Use notifications instead of monitoring for new text #14047
Conversation
Also, if this PR is merged, I'm really thinking it should be gated behind a feature flag. This is a fundamental change to how terminals work in NVDA. As a note for reviewers, I've written a few thoughts on doing this at #13781 (comment). |
While a fundamental change, it shouldn't have that much user visible differences on the front side. I'm pretty reluctant to introduce a feature flag for every single fundamental change. Feature flags tend to stay for ages without bringing the feature any further. |
Also CCing @carlos-zamora. |
See test results for failed build of commit 3ed04af591 |
I think that some check should be done on the windows terminal version as not all support UIA notifications |
No, because:
|
I've noticed that when it announces new text, everything is spoken as one line, so that this code
It would read it as 012345... Instead of each one on one line like it should |
@LeonarddeR I've provided a patched notification handler that should work around this (you'll need to |
I tested this briefly.
|
Fixed in the suggested change to the UIA notification handler above. As for the others, I think these are probably terminal issues. I'll ping @carlos-zamora. |
Strange! We shouldn't be doing anything differently, but I'll take a closer look at this later this week.
I could change this on the Terminal side and make it do less than the limit to fit an entire word/sentence in. But I'm concerned we would see some weird behavior when the newly output text is overwriting existing text or something like that. I think batching the notifications is the right approach here. Fun fact: @lhecker and I were just discussing batching notifications and the buffer this past Monday haha |
Hi, Note that the base implementation of UIA notification event handler will ignore background notifications. If it works differently in Windows Terminal object, then this might be something to think about. Also, keep in mind that the nature of UIA notification event is not really that of a dynamic content announcer - it is there to announce accessible event notifications. This is why I intentionally did not tie this setting to dynamic content changes when I first introduced notification event support in 2018, and that is also embedded in Windows App Essentials - to turn off UIA notification via that add-on, one must turn off "report notifications" from NVDA's object presentation settings panel. It is also another reason why I did work on a dedicated setting for UIA notification announcement. Thanks. |
Wouldn't making this based on EnhancedTermTypedCharSupport, excluding liveText, fix the punctuation issues along with clearing typed characters buffer when pressing tab or enter? |
|
How would we implement batching? Does Terminal know that it is sending a batch? If yes, I think it would help if Terminal communicates in the notification that this is a part of a batch that's not yet finished so NVDA can queue. If that isn't possible, I'm afraid we're getting into business with waiting and timeouts all over again, and I really want to avoid that if possible. |
@LeonarddeR Can we find a way not to register for or receive |
Do you have any proof of that statement (i.e. that it improves performance)? In what circumstances? Anyhow, you're raising an interesting question. I'm afraid the short answer is no, since we register to text changed notifications in the UIA handler, either globally or locally depending on selective event registration. However, as soon as we register, every text changed notification enters NVDA's python code and therefore can slow things down. I guess we can come up with a clone of AppModule.shouldProcessUIAPropertyChangedEvent, but that's again and again putting the real problem off before us. |
Yes. In particular, when we're flooded with new text:
|
That's pretty disconcerting. |
Co-authored-by: Bill Dengler <codeofdusk@gmail.com>
eecb992
to
2cafc67
Compare
Terminal won't be able to batch notifications because we get all the text from the shell we're connected to. So we have no knowledge if more text is on the way or not. You could loosely assume that if you received a large amount of text, a bunch more is on the way since you're presumably reading out the content of a large text file. But other than that (and that's a very loose heuristic), we can't really do much. @lhecker and I chatted a bit more about this earlier today. I've written down some notes in the Terminal repo here: microsoft/terminal#10822 (comment) |
See test results for failed build of commit a35cfcff40 |
Co-authored-by: Sean Budd <seanbudd123@gmail.com>
See test results for failed build of commit 28db16dd22 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Userguide changes read well. Thanks!
Is there a way to retain backwards compatibility by keeping |
I could make it an alias for the currently default implementation (diff-based for now, then notifications based later), but I don't think this would add very much value. This is an internal class that I highly doubt plugins would use. |
If the new classes are also intended to be internal classes, please prefix them with underscores. |
@@ -419,14 +424,50 @@ def findExtraOverlayClasses(obj, clsList): | |||
clsList.append(consoleUIAWindow) | |||
|
|||
|
|||
class WinTerminalUIA(EnhancedTermTypedCharSupport): | |||
class DiffBasedWinTerminalUIA(EnhancedTermTypedCharSupport): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should these classes be marked as internal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, for symmetry with the rest of the module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by symmetry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other Win*UIA
classes in this module don't have underscores.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that it is too late to fix the current practice, if these should be marked as internal, we should mark them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be a significant divergence from other similar classes in NVDAObjects.UIA
. A few examples:
NVDAObjects.UIA.VisualStudio.IntelliSenseList
NVDAObjects.UIA.wordDocument.UIACustomAttributeID
NVDAObjects.UIA.wordDocument.ElementsListDialog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the correct divergence to make.
What do you think @feerrenrut ? Note earlier conversation from #14047 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can acknowledge this is inconsistent with the existing code, however the inconsistency is due to a change process around add-on APIs. We need to be able to delineate where we commit to a stable add-on API and where we don't. If there is no expectation of add-ons needing the new code, it is safest to mark it internal only. This allows it to change more easily without going through a deprecation process. If add-on authors identify the code as useful for their add-on, and want it exposed, then we can have a discussion around that and consider if it should be exposed directly or via some level of abstraction.
@@ -419,14 +424,50 @@ def findExtraOverlayClasses(obj, clsList): | |||
clsList.append(consoleUIAWindow) | |||
|
|||
|
|||
class WinTerminalUIA(EnhancedTermTypedCharSupport): | |||
class DiffBasedWinTerminalUIA(EnhancedTermTypedCharSupport): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by symmetry?
Co-authored-by: Sean Budd <seanbudd123@gmail.com>
This comment was marked as outdated.
This comment was marked as outdated.
…into wtNotifications
FYI, I don't know if this is off topic for this request, but it looks like there is a spelling error in the change log: responsivity maybe should be responsiveness? |
Note, with many thanks to @codeofdusk
Link to issue number:
Closes #13781
Summary of the issue:
Windows Terminal supports UIA notification events to notify of new text. This is way quicker than the current diffing we use to calculate new text to speak in a terminal.
Description of user facing changes
Note: This is hidden behind a feature flag.
When enabled, this should improve responsivity whereas having minimal user impact. The only thing I noticed is that when typing echo is on, the last typed character/word is spoken after pressing enter, whereas in the old situation, the last typed char/word was always silenced. I'd say this is an improvement.
Description of development approach
Handle the Windows Terminal object as regular Editable Text, i.e. remove the terminal specific stuff from it.
Testing strategy:
Did a short Test in Windows Terminal. Observed that incoming notifications are spoken.
Known issues with pull request:
Character/word echo for passwords doubles as asterisks are written to the terminal and they are picked up by notification events.
Change log entries:
Code Review Checklist: