Fix modifier order in keycode string generation

Fix the order in which modifier keys are appended in as_text() and keycode_get_string() to ensure consistent and logical ordering (Ctrl, Alt, Shift, Meta). Refactored keycode_get_string() to use a vector for building the key string, improving readability and maintainability.
This commit is contained in:
Silver1063 2025-07-03 17:16:40 -07:00
parent 53be3b78d1
commit 00f5b230be
3 changed files with 46 additions and 30 deletions

View file

@ -256,12 +256,12 @@ String InputEventWithModifiers::as_text() const {
if (is_ctrl_pressed()) {
mod_names.push_back(find_keycode_name(Key::CTRL));
}
if (is_shift_pressed()) {
mod_names.push_back(find_keycode_name(Key::SHIFT));
}
if (is_alt_pressed()) {
mod_names.push_back(find_keycode_name(Key::ALT));
}
if (is_shift_pressed()) {
mod_names.push_back(find_keycode_name(Key::SHIFT));
}
if (is_meta_pressed()) {
mod_names.push_back(find_keycode_name(Key::META));
}