Show changed status
This commit is contained in:
parent
c84a256376
commit
3716300139
4 changed files with 80 additions and 36 deletions
|
|
@ -77,7 +77,7 @@ impl Tab {
|
|||
|
||||
pub fn save(&mut self) {
|
||||
if let Some(path) = &self.path_opt {
|
||||
let editor = self.editor.lock().unwrap();
|
||||
let mut editor = self.editor.lock().unwrap();
|
||||
let mut text = String::new();
|
||||
for line in editor.buffer().lines.iter() {
|
||||
text.push_str(line.text());
|
||||
|
|
@ -85,6 +85,7 @@ impl Tab {
|
|||
}
|
||||
match fs::write(path, text) {
|
||||
Ok(()) => {
|
||||
editor.set_changed(false);
|
||||
log::info!("saved {:?}", path);
|
||||
}
|
||||
Err(err) => {
|
||||
|
|
@ -96,6 +97,11 @@ impl Tab {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn changed(&self) -> bool {
|
||||
let editor = self.editor.lock().unwrap();
|
||||
editor.changed()
|
||||
}
|
||||
|
||||
pub fn icon(&self, size: u16) -> Icon {
|
||||
match &self.path_opt {
|
||||
Some(path) => mime_icon(path, size),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue