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 {
|
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(),
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user