Add dialog for opening project, highlight active file in project menu
This commit is contained in:
parent
0117a7bc02
commit
8dd38517ab
4 changed files with 107 additions and 48 deletions
16
src/tab.rs
16
src/tab.rs
|
|
@ -56,11 +56,17 @@ impl Tab {
|
|||
let mut editor = editor.borrow_with(&mut font_system);
|
||||
match editor.load_text(&path, self.attrs) {
|
||||
Ok(()) => {
|
||||
log::info!("opened '{}'", path.display());
|
||||
self.path_opt = Some(path);
|
||||
log::info!("opened {:?}", path);
|
||||
self.path_opt = match fs::canonicalize(&path) {
|
||||
Ok(ok) => Some(ok),
|
||||
Err(err) => {
|
||||
log::error!("failed to canonicalize {:?}: {}", path, err);
|
||||
Some(path)
|
||||
}
|
||||
};
|
||||
}
|
||||
Err(err) => {
|
||||
log::error!("failed to open '{}': {}", path.display(), err);
|
||||
log::error!("failed to open {:?}: {}", path, err);
|
||||
self.path_opt = None;
|
||||
}
|
||||
}
|
||||
|
|
@ -76,10 +82,10 @@ impl Tab {
|
|||
}
|
||||
match fs::write(path, text) {
|
||||
Ok(()) => {
|
||||
log::info!("saved '{}'", path.display());
|
||||
log::info!("saved {:?}", path);
|
||||
}
|
||||
Err(err) => {
|
||||
log::error!("failed to save '{}': {}", path.display(), err);
|
||||
log::error!("failed to save {:?}: {}", path, err);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue