feat: display save indicator on new files

This commit is contained in:
Stevan Freeborn
2026-02-21 05:31:00 -06:00
parent 5faa42a3e1
commit 7462943c04
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ pub struct File {
impl Default for File { impl Default for File {
fn default() -> Self { fn default() -> Self {
File { File {
needs_saving: false, needs_saving: true,
content: text_editor::Content::new(), content: text_editor::Content::new(),
path: None, path: None,
markdown: Vec::new(), markdown: Vec::new(),
+1
View File
@@ -75,6 +75,7 @@ impl State {
pub fn open_file(&mut self, path: PathBuf, content: String) { pub fn open_file(&mut self, path: PathBuf, content: String) {
if let Some(index) = self.files.iter().position(|f| f.path() == Some(&path)) { if let Some(index) = self.files.iter().position(|f| f.path() == Some(&path)) {
self.files[index].set_content(&content); self.files[index].set_content(&content);
self.files[index].set_needs_saving(false);
self.current_file = index; self.current_file = index;
return; return;
} }