mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +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
Notes:
sideshowbarker
2024-07-17 11:33:31 +09:00
Author: https://github.com/LucasChollet Commit: https://github.com/SerenityOS/serenity/commit/881f499704 Pull-request: https://github.com/SerenityOS/serenity/pull/13787 Issue: https://github.com/SerenityOS/serenity/issues/13253
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…
Reference in a new issue