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

Allow setting terminal cursor for screen readers and IME preview using ui_adaptor #59035

Merged
merged 2 commits into from
Jul 23, 2022

Conversation

Qrox
Copy link
Contributor

@Qrox Qrox commented Jul 7, 2022

Summary

Infrastructure "Allow setting terminal cursor for screen readers and IME preview using ui_adaptor"

Purpose of change

The ncurses cursor is used by screen readers and used as the position for IME preview, but it is transient -- any output will change its position, making the code prone to regression when new code is added. Contributes to #39638.

Describe the solution

Set the desired final cursor via ui_adaptor, which automatically sets the cursor to the desired position once all UIs finish drawing.

Migrate existing UIs that set the cursor to the new system.

Finally, place cursor at the highlighted line in the player display (@) menu to demonstrate the flexibility of the system. disable_cursor() and set_cursor() are used to place the cursor at the correct line without having the output code of the non-active UIs interfere with the cursor.

Describe alternatives you've considered

A on_out_of_scope solution might work too, but some drawing code spans several functions, which will make a scope-based solution complicated.

Testing

Tested all affected UIs on the ncurses build. The IME preview was shown at the desired cursor position, so screen readers should also work in these UIs.

Also tested all affected UIs on the tiles build, and the UIs worked as before. Tested #45951 and there was no regression.

Additional context

This should make it somewhat easier to add screen reader support to the remaining menus in #39638.

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. Map / Mapgen Overmap, Mapgen, Map extras, Map display Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions <Documentation> Design documents, internal info, guides and help. [Markdown] Markdown issues and PRs BasicBuildPassed This PR builds correctly, label assigned by github actions labels Jul 7, 2022
@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jul 8, 2022
src/string_input_popup.h Outdated Show resolved Hide resolved
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style <Documentation> Design documents, internal info, guides and help. Info / User Interface Game - player communication, menus, etc. json-styled JSON lint passed, label assigned by github actions Map / Mapgen Overmap, Mapgen, Map extras, Map display [Markdown] Markdown issues and PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants