More implementation of new buffer abstraction

This commit is contained in:
Jeremy Soller 2022-10-20 19:34:56 -06:00
parent 2bbacf5636
commit 441112b5e2
No known key found for this signature in database
GPG key ID: 87F211AF2BE4C2FE
7 changed files with 244 additions and 397 deletions

View file

@ -171,7 +171,11 @@ impl Application for Window {
Message::Save => {
if let Some(path) = &self.path_opt {
let buffer = self.buffer.lock().unwrap();
let text = buffer.text_lines().join("\n");
let mut text = String::new();
for line in buffer.text_lines() {
text.push_str(line.text());
text.push('\n');
}
match fs::write(path, text) {
Ok(()) => {
log::info!("saved '{}'", path.display());