mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibGUI: Use normalized TextRange for early empty string check
Fixes #6141. Allows to copy "backward" selections.
This commit is contained in:
parent
1f65c2a981
commit
8646f8f4ad
Notes:
sideshowbarker
2024-07-18 20:45:51 +09:00
Author: https://github.com/sppmacd Commit: https://github.com/SerenityOS/serenity/commit/8646f8f4ad3 Pull-request: https://github.com/SerenityOS/serenity/pull/6142 Issue: https://github.com/SerenityOS/serenity/issues/6141
1 changed files with 2 additions and 2 deletions
|
@ -343,9 +343,9 @@ String TextDocument::text() const
|
|||
|
||||
String TextDocument::text_in_range(const TextRange& a_range) const
|
||||
{
|
||||
if (is_empty() || line_count() < a_range.end().line() - a_range.start().line() || line(a_range.start().line()).is_empty())
|
||||
return String("");
|
||||
auto range = a_range.normalized();
|
||||
if (is_empty() || line_count() < range.end().line() - range.start().line() || line(range.start().line()).is_empty())
|
||||
return String("");
|
||||
|
||||
StringBuilder builder;
|
||||
for (size_t i = range.start().line(); i <= range.end().line(); ++i) {
|
||||
|
|
Loading…
Reference in a new issue