mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:17:35 +00:00
GTextEditor: Fix broken rendering of selection on wrapped lines
This logic broke when converting String::length() to return size_t.
This commit is contained in:
parent
cdb00530f8
commit
7301db4f9a
1 changed files with 3 additions and 3 deletions
|
@ -410,11 +410,11 @@ void GTextEditor::paint_event(GPaintEvent& event)
|
||||||
bool selection_ends_on_current_visual_line = visual_line_index == last_visual_line_with_selection;
|
bool selection_ends_on_current_visual_line = visual_line_index == last_visual_line_with_selection;
|
||||||
|
|
||||||
int selection_left = selection_begins_on_current_visual_line
|
int selection_left = selection_begins_on_current_visual_line
|
||||||
? content_x_for_position({ line_index, selection_start_column_within_line })
|
? content_x_for_position({ line_index, (size_t)selection_start_column_within_line })
|
||||||
: m_horizontal_content_padding;
|
: m_horizontal_content_padding;
|
||||||
|
|
||||||
int selection_right = selection_ends_on_current_visual_line
|
int selection_right = selection_ends_on_current_visual_line
|
||||||
? content_x_for_position({ line_index, selection_end_column_within_line })
|
? content_x_for_position({ line_index, (size_t)selection_end_column_within_line })
|
||||||
: visual_line_rect.right() + 1;
|
: visual_line_rect.right() + 1;
|
||||||
|
|
||||||
Rect selection_rect {
|
Rect selection_rect {
|
||||||
|
@ -426,7 +426,7 @@ void GTextEditor::paint_event(GPaintEvent& event)
|
||||||
|
|
||||||
painter.fill_rect(selection_rect, Color::from_rgb(0x955233));
|
painter.fill_rect(selection_rect, Color::from_rgb(0x955233));
|
||||||
|
|
||||||
size_t start_of_selection_within_visual_line = max((size_t)0, selection_start_column_within_line - 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;
|
||||||
|
|
||||||
StringView visual_selected_text {
|
StringView visual_selected_text {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue