From e24f1dfbe1281fc0f50a5b2d85c8491d929eaab6 Mon Sep 17 00:00:00 2001 From: dylanbobb Date: Sat, 5 Jun 2021 20:47:10 -0400 Subject: [PATCH] LibGUI: Don't delete within a line if the line is empty --- Userland/Libraries/LibGUI/TextDocument.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Libraries/LibGUI/TextDocument.cpp b/Userland/Libraries/LibGUI/TextDocument.cpp index 93ba964fc9..e116677f74 100644 --- a/Userland/Libraries/LibGUI/TextDocument.cpp +++ b/Userland/Libraries/LibGUI/TextDocument.cpp @@ -879,6 +879,9 @@ void TextDocument::remove(const TextRange& unnormalized_range) if (range.start().line() == range.end().line()) { // Delete within same line. auto& line = this->line(range.start().line()); + if (line.length() == 0) + return; + bool whole_line_is_selected = range.start().column() == 0 && range.end().column() == line.length(); if (whole_line_is_selected) {