From c58570ebafa7bb5b5e53152067297c8b12a317a7 Mon Sep 17 00:00:00 2001 From: speles Date: Thu, 25 Feb 2021 17:33:45 +0200 Subject: [PATCH] LibGUI: Make empty TextRange invalid Having TextRange which is empty doesn't make any sense. So it confuses the functions that rely on having valid range, and causes them to do no action. Fixes #5341 --- Userland/Libraries/LibGUI/TextRange.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGUI/TextRange.h b/Userland/Libraries/LibGUI/TextRange.h index 222edbca01..ea6918c0f4 100644 --- a/Userland/Libraries/LibGUI/TextRange.h +++ b/Userland/Libraries/LibGUI/TextRange.h @@ -40,7 +40,7 @@ public: { } - bool is_valid() const { return m_start.is_valid() && m_end.is_valid(); } + bool is_valid() const { return m_start.is_valid() && m_end.is_valid() && m_start != m_end; } void clear() { m_start = {};