Skip to content

Return \n to end of line in case it's deleted #197

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions vhdl_lang/src/data/contents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ impl Contents {
}
}

// New line should always be at the end of line, in case
// it's deleted by accident somehow, return it back.
if merged_content.chars().last().unwrap_or('\0') != '\n' {
merged_content.push('\n');
}

let end_line = std::cmp::min(self.lines.len().saturating_sub(1), end_line);
self.lines
.splice(
Expand Down