mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:27:45 +00:00
LibGUI: Fix text wrap artifact when selecting text
The issue was caused by the usage of the selection_end_column_within_line variable as if it was the visual line. This is fixed by taking the minimum between this value and the length of a visual line.
This commit is contained in:
parent
559ea5a030
commit
881f499704
1 changed files with 2 additions and 2 deletions
|
@ -686,8 +686,8 @@ void TextEditor::paint_event(PaintEvent& event)
|
|||
}
|
||||
|
||||
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;
|
||||
size_t const start_of_selection_within_visual_line = (size_t)max(0, (int)selection_start_column_within_line - (int)start_of_visual_line);
|
||||
size_t const end_of_selection_within_visual_line = min(selection_end_column_within_line - start_of_visual_line, visual_line_text.length());
|
||||
|
||||
bool current_visual_line_has_selection = start_of_selection_within_visual_line != end_of_selection_within_visual_line
|
||||
&& ((line_index != selection.start().line() && line_index != selection.end().line())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue