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

LibWeb: Add support for navigating text <input> with End key

This commit is contained in:
Kenneth Myhra 2022-02-19 18:42:08 +01:00 committed by Andreas Kling
parent 939c10b201
commit 8a168b2bc0

View file

@ -515,6 +515,11 @@ bool EventHandler::handle_keydown(KeyCode key, unsigned modifiers, u32 code_poin
m_browsing_context.set_cursor_position(DOM::Position { node, 0 });
return true;
}
if (key == KeyCode::Key_End) {
auto& node = *static_cast<DOM::Text*>(const_cast<DOM::Node*>(m_browsing_context.cursor_position().node()));
m_browsing_context.set_cursor_position(DOM::Position { node, (unsigned)node.data().length() });
return true;
}
if (!should_ignore_keydown_event(code_point)) {
m_edit_event_handler->handle_insert(m_browsing_context.cursor_position(), code_point);
m_browsing_context.increment_cursor_position_offset();