1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:58:11 +00:00

LibGUI: Don't delete within a line if the line is empty

This commit is contained in:
dylanbobb 2021-06-05 20:47:10 -04:00 committed by Andreas Kling
parent 2c8309c841
commit e24f1dfbe1

View file

@ -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) {