diff options
author | Tibor Nagy <xnagytibor@gmail.com> | 2020-02-15 16:26:52 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-15 18:42:13 +0100 |
commit | 7ec1b2e44b4644175bfbcb0f311f81c3554c3e29 (patch) | |
tree | be5b16fb597fd30853f06a8c9ac8629c0162c940 /Libraries/LibGUI/TextEditor.cpp | |
parent | e455af8d338b0f78af62d6c8851d7c9b75a96f50 (diff) | |
download | serenity-7ec1b2e44b4644175bfbcb0f311f81c3554c3e29.zip |
LibGUI: Unfocused TextEditors should use inactive selection colors
Diffstat (limited to 'Libraries/LibGUI/TextEditor.cpp')
-rw-r--r-- | Libraries/LibGUI/TextEditor.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Libraries/LibGUI/TextEditor.cpp b/Libraries/LibGUI/TextEditor.cpp index 5e2daad581..3bcc8ca5a2 100644 --- a/Libraries/LibGUI/TextEditor.cpp +++ b/Libraries/LibGUI/TextEditor.cpp @@ -474,7 +474,10 @@ void TextEditor::paint_event(PaintEvent& event) visual_line_rect.height() }; - painter.fill_rect(selection_rect, palette().selection()); + Color background_color = is_focused() ? palette().selection() : palette().inactive_selection(); + Color text_color = is_focused() ? palette().selection_text() : palette().inactive_selection_text(); + + painter.fill_rect(selection_rect, background_color); size_t start_of_selection_within_visual_line = (size_t)max(0, (int)selection_start_column_within_line - (int)start_of_visual_line); size_t end_of_selection_within_visual_line = selection_end_column_within_line - start_of_visual_line; @@ -484,7 +487,7 @@ void TextEditor::paint_event(PaintEvent& event) end_of_selection_within_visual_line - start_of_selection_within_visual_line }; - painter.draw_text(selection_rect, visual_selected_text, Gfx::TextAlignment::CenterLeft, palette().selection_text()); + painter.draw_text(selection_rect, visual_selected_text, Gfx::TextAlignment::CenterLeft, text_color); } } ++visual_line_index; |