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

AutomationPeer editor extension #332

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sloutsky
Copy link
Contributor

Add extension to text editor that allows to inject automation peer that represents IntelliSense suggestion list and the currently selected suggestion - to allow screen narrators to read the suggestion.

@siegfriedpammer
Copy link
Member

Thank you very much for your pull request! The changes are looking good, just a few remarks:

  1. Can you please clean up the commits? 3 of the 4 commits in this pull request are not related to the actual change.
  2. Can you please rename/remove all references to "IntelliSense"... AvalonEdit uses the word "CodeCompletion", we want to prevent any confusion.

If you don't have time to apply these changes, I can do that for you once we merge this.

I will have to take a closer look and test how Narrator behaves now.

@sloutsky
Copy link
Contributor Author

I have renamed the property. Now I need to figure how to get rid of the "bad commits"

@siegfriedpammer

This comment has been minimized.

@sloutsky sloutsky force-pushed the automationpeer-editor-extension branch from 4b05e8c to 35ccb67 Compare December 27, 2021 14:54
@siegfriedpammer

This comment has been minimized.

@sloutsky

This comment has been minimized.

…at represents IntelliSense suggesiton list and the currently selected suggestion - to allow screen narrators to read the suggestion.
@siegfriedpammer siegfriedpammer changed the title Automationpeer editor extension AutomationPeer editor extension Dec 28, 2021
@siegfriedpammer
Copy link
Member

Hmmm, it seems, this change currently does not provide a out-of-the-box solution for users of AvalonEdit. I would have expected Narrator to properly work out-of-the-box with how we currently use/instantiate the CompletionWindow in the sample application:

CompletionWindow completionWindow;
void textEditor_TextArea_TextEntered(object sender, TextCompositionEventArgs e)
{
if (e.Text == ".") {
// open code completion after the user has pressed dot:
completionWindow = new CompletionWindow(textEditor.TextArea);
// provide AvalonEdit with the data:
IList<ICompletionData> data = completionWindow.CompletionList.CompletionData;
data.Add(new MyCompletionData("Item1"));
data.Add(new MyCompletionData("Item2"));
data.Add(new MyCompletionData("Item3"));
data.Add(new MyCompletionData("Another item"));
completionWindow.Show();
completionWindow.Closed += delegate {
completionWindow = null;
};
}
}
void textEditor_TextArea_TextEntering(object sender, TextCompositionEventArgs e)
{
if (e.Text.Length > 0 && completionWindow != null) {
if (!char.IsLetterOrDigit(e.Text[0])) {
// Whenever a non-letter is typed while the completion window is open,
// insert the currently selected element.
completionWindow.CompletionList.RequestInsertion(e);
}
}
// do not set e.Handled=true - we still want to insert the character that was typed
}

Seems like I will have to dig around to get this to work properly like in VS. Thanks anyway for the starting point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants