From 228c1f496853da8869a20c9e387cc5ed65bb2be1 Mon Sep 17 00:00:00 2001 From: Max Wipfli Date: Thu, 6 May 2021 17:50:54 +0200 Subject: LibGUI: Remove line-is-empty check in TextDocument return-early This patch removes an incorrect way for TextDocument::text_in_range to return early when the first line of the selection was empty. This fixes an issue in TextEditor where the status bar showed that 0 characters are selected when the selection started on an empty line. --- Userland/Libraries/LibGUI/TextDocument.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Userland/Libraries/LibGUI/TextDocument.cpp') diff --git a/Userland/Libraries/LibGUI/TextDocument.cpp b/Userland/Libraries/LibGUI/TextDocument.cpp index f42cfa4624..e007ce65cc 100644 --- a/Userland/Libraries/LibGUI/TextDocument.cpp +++ b/Userland/Libraries/LibGUI/TextDocument.cpp @@ -343,7 +343,7 @@ String TextDocument::text() const String TextDocument::text_in_range(const TextRange& a_range) const { auto range = a_range.normalized(); - if (is_empty() || line_count() < range.end().line() - range.start().line() || line(range.start().line()).is_empty()) + if (is_empty() || line_count() < range.end().line() - range.start().line()) return String(""); StringBuilder builder; -- cgit v1.2.3