summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Elliott <pelliott@ualberta.ca>2021-10-10 16:12:47 -0600
committerAndreas Kling <kling@serenityos.org>2021-10-17 22:18:48 +0200
commitc19d868a3e4011c104deccd9c0ceb003d723ad08 (patch)
treeffcb21ce38b00515f629e03a78aba91c361852cd
parent92b6e4fd767145d3bfc408fe036cdf63e09a9d89 (diff)
downloadserenity-c19d868a3e4011c104deccd9c0ceb003d723ad08.zip
LibGUI: Don't render placeholders as secret
before my placeholder 'password' showed up as '********'.
-rw-r--r--Userland/Libraries/LibGUI/TextEditor.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp
index be59ba00eb..5d42ae0491 100644
--- a/Userland/Libraries/LibGUI/TextEditor.cpp
+++ b/Userland/Libraries/LibGUI/TextEditor.cpp
@@ -402,8 +402,8 @@ void TextEditor::paint_event(PaintEvent& event)
// NOTE: This lambda and TextEditor::text_width_for_font() are used to substitute all glyphs with m_substitution_code_point if necessary.
// Painter::draw_text() and Gfx::Font::width() should not be called directly, but using this lambda and TextEditor::text_width_for_font().
- auto draw_text = [&](Gfx::IntRect const& rect, auto const& raw_text, Gfx::Font const& font, Gfx::TextAlignment alignment, Gfx::Color color) {
- if (m_substitution_code_point) {
+ auto draw_text = [&](Gfx::IntRect const& rect, auto const& raw_text, Gfx::Font const& font, Gfx::TextAlignment alignment, Gfx::Color color, bool substitue = true) {
+ if (m_substitution_code_point && substitue) {
painter.draw_text(rect, substitution_code_point_view(raw_text.length()), font, alignment, color);
} else {
painter.draw_text(rect, raw_text, font, alignment, color);
@@ -519,7 +519,7 @@ void TextEditor::paint_event(PaintEvent& event)
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));
+ draw_text(line_rect, placeholder(), font(), m_text_alignment, palette().color(Gfx::ColorRole::PlaceholderText), false);
} else if (!document().has_spans()) {
// Fast-path for plain text
auto color = palette().color(is_enabled() ? foreground_role() : Gfx::ColorRole::DisabledText);