mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-28 04:08:08 +00:00
LibGUI: Don't paint TextEditor selection in non-focused widgets
Showing the selection in non-focused text editors was not really useful, since refocusing the widget would clear or change the selection immediately anyway. Note that TextEditors in inactive windows can still be the focused widget within that window, and will still be painted with an "inactive" looking selection.
This commit is contained in:
@@ -670,7 +670,7 @@ void TextEditor::paint_event(PaintEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
if (physical_line_has_selection) {
|
||||
if (physical_line_has_selection && window()->focused_widget() == this) {
|
||||
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;
|
||||
|
||||
@@ -696,8 +696,8 @@ void TextEditor::paint_event(PaintEvent& event)
|
||||
visual_line_rect.height()
|
||||
};
|
||||
|
||||
Color background_color = is_focused() ? palette().selection() : palette().inactive_selection();
|
||||
Color text_color = is_focused() ? palette().selection_text() : palette().inactive_selection_text();
|
||||
Color background_color = window()->is_active() ? palette().selection() : palette().inactive_selection();
|
||||
Color text_color = window()->is_active() ? palette().selection_text() : palette().inactive_selection_text();
|
||||
|
||||
painter.fill_rect(selection_rect, background_color);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user