mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:58:13 +00:00
LibGUI: Unfocused TextEditors should use inactive selection colors
This commit is contained in:
parent
e455af8d33
commit
7ec1b2e44b
1 changed files with 5 additions and 2 deletions
|
@ -474,7 +474,10 @@ void TextEditor::paint_event(PaintEvent& event)
|
||||||
visual_line_rect.height()
|
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 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;
|
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
|
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;
|
++visual_line_index;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue