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

[ui] Properly render control character in keybindings list #54350

Merged
merged 1 commit into from
Jan 15, 2022

Conversation

J-Fields
Copy link
Contributor

@J-Fields J-Fields commented Jan 13, 2022

Summary

Interface "Give names to keys that use CTRL in keybindings list"

Purpose of change

You can currently map control characters, but they display as unknown key <code>.

Describe the solution

Add display names for them to the map input_manager::get_keyname() references

Describe alternatives you've considered

Mapping more control characters... I think they're all portable, but I'm never sure about this stuff, so if you're reading this and know, lmk.

Testing

Checked that they rendered properly:
image

Additional context

@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Jan 13, 2022
@J-Fields J-Fields marked this pull request as draft January 13, 2022 06:13
src/input.cpp Outdated Show resolved Hide resolved
src/input.cpp Outdated
for( char c = 'A'; c <= 'Z'; c++ ) {
add_keyboard_char_keycode_pair( c - 64, string_format( "CTRL+%s", c ) );
}

// function keys, as defined by ncurses
for( int i = F_KEY_NUM_BEG; i <= F_KEY_NUM_END; i++ ) {
// not marked for translation here, but specially handled in get_keyname so
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same should be done for control characters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be fixed; lmk if I messed something up

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jan 13, 2022
@chrispikula
Copy link
Contributor

You don't know how much I appreciate this.

@Maleclypse Maleclypse added Controls / Input Keyboard, mouse, keybindings, input UI, etc. [C++] Changes (can be) made in C++. Previously named `Code` labels Jan 14, 2022
@J-Fields J-Fields force-pushed the ctrl-key-name branch 2 times, most recently from 52a2caa to 253c654 Compare January 15, 2022 04:37
@J-Fields J-Fields marked this pull request as ready for review January 15, 2022 04:38
@J-Fields J-Fields changed the title [ui] Properly render control characters ^A through ^Z in keybindings list [ui] Properly render control character in keybindings list Jan 15, 2022
@kevingranade kevingranade merged commit 56ae13e into CleverRaven:master Jan 15, 2022
@J-Fields J-Fields deleted the ctrl-key-name branch January 15, 2022 22:11
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` Controls / Input Keyboard, mouse, keybindings, input UI, etc. json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants