From b3a67ee088d5bd2fb8d76d3e6f9adeff2cb8a6b6 Mon Sep 17 00:00:00 2001 From: Alec Murphy Date: Thu, 8 Aug 2024 13:37:46 -0400 Subject: [PATCH] LibWeb: Skip trim trailing whitespace if user is typing This PR stops the cursor from disappearing while typing trailing spaces in a text input box. --- Userland/Libraries/LibWeb/Layout/LineBox.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Libraries/LibWeb/Layout/LineBox.cpp b/Userland/Libraries/LibWeb/Layout/LineBox.cpp index 0e5a6c527d..360efab2a3 100644 --- a/Userland/Libraries/LibWeb/Layout/LineBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/LineBox.cpp @@ -50,6 +50,9 @@ void LineBox::trim_trailing_whitespace() return; // last_fragment cannot be null from here on down, as m_fragments is not empty. last_fragment = &m_fragments.last(); + auto dom_node = last_fragment->layout_node().dom_node(); + if (dom_node && dom_node->is_editable() && dom_node->document().cursor_position()) + return; if (!should_trim(last_fragment)) return; if (last_fragment->is_justifiable_whitespace()) {