瀏覽代碼

LibGUI: TextEditor should paint text with disabled color when disabled

Andreas Kling 5 年之前
父節點
當前提交
3a34323a78
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      Libraries/LibGUI/TextEditor.cpp

+ 2 - 1
Libraries/LibGUI/TextEditor.cpp

@@ -416,7 +416,8 @@ void TextEditor::paint_event(PaintEvent& event)
 #endif
 #endif
             if (!document().has_spans()) {
             if (!document().has_spans()) {
                 // Fast-path for plain text
                 // Fast-path for plain text
-                painter.draw_text(visual_line_rect, visual_line_text, m_text_alignment, palette().color(foreground_role()));
+                auto color = palette().color(is_enabled() ? foreground_role() : Gfx::ColorRole::DisabledText);
+                painter.draw_text(visual_line_rect, visual_line_text, m_text_alignment, color);
             } else {
             } else {
                 int advance = font().glyph_width(' ') + font().glyph_spacing();
                 int advance = font().glyph_width(' ') + font().glyph_spacing();
                 Gfx::Rect character_rect = { visual_line_rect.location(), { font().glyph_width(' '), line_height() } };
                 Gfx::Rect character_rect = { visual_line_rect.location(), { font().glyph_width(' '), line_height() } };