1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:07:35 +00:00

LibVT: Mask out keypad keys while in keypad application mode

This commit is contained in:
hanaa12G 2023-12-05 04:48:32 +07:00 committed by Ali Mohammad Pur
parent d6c8b4d279
commit dea61d95db
2 changed files with 8 additions and 2 deletions

View file

@ -943,12 +943,12 @@ void Terminal::DECDC(Parameters params)
void Terminal::DECKPNM()
{
dbgln("FIXME: implement setting the keypad to numeric mode");
m_in_application_keypad_mode = false;
}
void Terminal::DECKPAM()
{
dbgln("FIXME: implement setting the keypad to application mode");
m_in_application_keypad_mode = true;
}
void Terminal::DSR(Parameters params)
@ -1327,6 +1327,7 @@ void Terminal::handle_key_press(KeyCode key, u32 code_point, u8 flags)
bool ctrl = flags & Mod_Ctrl;
bool alt = flags & Mod_Alt;
bool shift = flags & Mod_Shift;
bool keypad = flags & Mod_Keypad;
unsigned modifier_mask = int(shift) + (int(alt) << 1) + (int(ctrl) << 2);
auto emit_final_with_modifier = [this, modifier_mask](char final) {
@ -1347,6 +1348,10 @@ void Terminal::handle_key_press(KeyCode key, u32 code_point, u8 flags)
emit_string(builder.string_view());
};
if (keypad && m_in_application_keypad_mode) {
return;
}
switch (key) {
case KeyCode::Key_Up:
emit_final_with_modifier('A');