From 8a168b2bc001727f85c03cc39bdbb7996aa017a2 Mon Sep 17 00:00:00 2001 From: Kenneth Myhra Date: Sat, 19 Feb 2022 18:42:08 +0100 Subject: [PATCH] LibWeb: Add support for navigating text with End key --- Userland/Libraries/LibWeb/Page/EventHandler.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.cpp b/Userland/Libraries/LibWeb/Page/EventHandler.cpp index e14de1c777..5c19a40a40 100644 --- a/Userland/Libraries/LibWeb/Page/EventHandler.cpp +++ b/Userland/Libraries/LibWeb/Page/EventHandler.cpp @@ -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(const_cast(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();