mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:18:12 +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
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…
Add table
Add a link
Reference in a new issue