feat: display save indicator on new files
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@ pub struct File {
|
||||
impl Default for File {
|
||||
fn default() -> Self {
|
||||
File {
|
||||
needs_saving: false,
|
||||
needs_saving: true,
|
||||
content: text_editor::Content::new(),
|
||||
path: None,
|
||||
markdown: Vec::new(),
|
||||
|
||||
@@ -75,6 +75,7 @@ impl State {
|
||||
pub fn open_file(&mut self, path: PathBuf, content: String) {
|
||||
if let Some(index) = self.files.iter().position(|f| f.path() == Some(&path)) {
|
||||
self.files[index].set_content(&content);
|
||||
self.files[index].set_needs_saving(false);
|
||||
self.current_file = index;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user