From f8798c154bd3cbfb4cc19a9799a5a31724bef8f3 Mon Sep 17 00:00:00 2001 From: networkException Date: Tue, 6 Jul 2021 16:44:44 +0200 Subject: [PATCH] LibGUI: Draw the placeholder of a TextEditor also when it is focused Previously focusing a TextEditor would cause the placeholder to disapper. This is unpractical editors that get focused automatically for example. --- Userland/Libraries/LibGUI/TextEditor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp index 19f9491b19..3a9617d0e8 100644 --- a/Userland/Libraries/LibGUI/TextEditor.cpp +++ b/Userland/Libraries/LibGUI/TextEditor.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2018-2020, Andreas Kling + * Copyright (c) 2021, Jakob-Niklas See * * SPDX-License-Identifier: BSD-2-Clause */ @@ -510,7 +511,7 @@ void TextEditor::paint_event(PaintEvent& event) if constexpr (TEXTEDITOR_DEBUG) painter.draw_rect(visual_line_rect, Color::Cyan); - if (!placeholder().is_empty() && document().is_empty() && !is_focused() && line_index == 0) { + if (!placeholder().is_empty() && document().is_empty() && line_index == 0) { auto line_rect = visual_line_rect; line_rect.set_width(text_width_for_font(placeholder(), font())); draw_text(line_rect, placeholder(), font(), m_text_alignment, palette().color(Gfx::ColorRole::PlaceholderText));