1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +00:00

LibGUI: Make TextEditor write a trailing newline to non-empty files

Fixes #4801.
This commit is contained in:
Andreas Kling 2021-02-15 18:02:33 +01:00
parent a048f46be5
commit 7f616449ec
2 changed files with 23 additions and 14 deletions

View file

@ -79,6 +79,11 @@ void TextDocument::set_text(const StringView& text)
add_line(i);
}
add_line(i);
// Don't show the file's trailing newline as an actual new line.
if (line_count() > 1 && line(line_count() - 1).is_empty())
m_lines.take_last();
m_client_notifications_enabled = true;
for (auto* client : m_clients)