Better handling of newlines in editor insert and delete

This commit is contained in:
Jeremy Soller 2025-10-09 12:21:38 -06:00
parent c5deb38cfe
commit 5cc64c77c1
No known key found for this signature in database
GPG key ID: 670FDFB5428E05CA
5 changed files with 117 additions and 42 deletions

View file

@ -690,7 +690,15 @@ impl Buffer {
shaping,
));
}
if self.lines.is_empty() {
// Ensure there is an ending line with no line ending
if self
.lines
.last()
.map(|line| line.ending())
.unwrap_or(LineEnding::default())
!= LineEnding::None
{
self.lines.push(BufferLine::new(
"",
LineEnding::None,