WIP - expand EditorAction type
This commit is contained in:
1 parent
cab6dc76b1
commit
26e87c9d8a
2 files changed
+21
-1
No files matched your search
+11
@@ -169,6 +169,8 @@ impl EditorCore {
|
||||
}
|
||||
}
|
||||
|
||||
/// `handle_action` is a very large method that is the entry point for the action handling
|
||||
/// system.
|
||||
#[tracing::instrument(skip(self))]
|
||||
fn handle_action(&mut self, action: EditorAction) {
|
||||
use EditorAction::*;
|
||||
@@ -244,6 +246,15 @@ impl EditorCore {
|
||||
self.pane_layout.remove(buffer_id);
|
||||
}
|
||||
}
|
||||
|
||||
OpenFile(file) => {
|
||||
log_only(self.load_file(&file));
|
||||
}
|
||||
WriteBuffer(path) => log_only(self.write_current_buffer(path)),
|
||||
Error(err) => {
|
||||
error!(err, "Command Output Error");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
-1
@@ -1,3 +1,5 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// This module defines `EditorAction`, a large type representing every possible
|
||||
/// thing the text editor can do. Several other types that are only used as children of
|
||||
/// `EditorAction`s are defined here as well.
|
||||
@@ -27,11 +29,18 @@ pub(crate) enum EditorAction {
|
||||
/// Quit the editor
|
||||
Quit,
|
||||
|
||||
|
||||
// TODO: ported over from old CommandOutput struct - clean up later
|
||||
OpenFile(PathBuf),
|
||||
WriteBuffer(Option<PathBuf>),
|
||||
// in particular these two are too general
|
||||
//
|
||||
/// Show or hide the popup help
|
||||
PopupHelp(bool),
|
||||
|
||||
/// Show or hide the Finder
|
||||
ToggleFinder(bool),
|
||||
//TODO rename this to something like commanderror
|
||||
Error(String),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
||||
Reference in new issue
Block a user