More implementation of new buffer abstraction
This commit is contained in:
parent
2bbacf5636
commit
441112b5e2
7 changed files with 244 additions and 397 deletions
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue