Introduce LineEnding to editor and fix inconsistencies
This commit is contained in:
parent
00a048677f
commit
87165ccd29
5 changed files with 93 additions and 60 deletions
|
|
@ -117,8 +117,16 @@ impl Editor {
|
|||
} else {
|
||||
self.is_loading = true;
|
||||
|
||||
let mut text = self.content.text();
|
||||
|
||||
if let Some(ending) = self.content.line_ending() {
|
||||
if !text.ends_with(ending.as_str()) {
|
||||
text.push_str(ending.as_str());
|
||||
}
|
||||
}
|
||||
|
||||
Task::perform(
|
||||
save_file(self.file.clone(), self.content.text()),
|
||||
save_file(self.file.clone(), text),
|
||||
Message::FileSaved,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue