aboutsummaryrefslogtreecommitdiffstats
path: root/src/errors.rs
diff options
context:
space:
mode:
authorBrooks Rady <b.j.rady@gmail.com>2021-01-13 13:10:48 +0000
committerGitHub <noreply@github.com>2021-01-13 13:10:48 +0000
commite7f16ed468902375b91b97f1093c4b9f8531acf1 (patch)
tree5809dbdfb42ffbc3329f5bfcd6faee62d94efe58 /src/errors.rs
parentrefactor(terminal-pane): simplify Scroll into Grid (#137) (diff)
parentPatched a width miscalculation in the status bar plugin (diff)
downloadsl0ppij-e7f16ed468902375b91b97f1093c4b9f8531acf1.tar.gz
sl0ppij-e7f16ed468902375b91b97f1093c4b9f8531acf1.tar.xz
sl0ppij-e7f16ed468902375b91b97f1093c4b9f8531acf1.zip
feat(ui): added a help / status bar for keybindings and modes
To implement this status bar as a plugin (https://github.com/mosaic-org/status-bar/blob/master/src/main.rs), the following bits of infrastructure were changed: - Layouts can now have an exact size constraint (1 row high, for example) - Unconstrained blocks in a layout are now grown to fill the remaining space - Default plugins and layouts are now stored in an OS-dependent data directory. The initial installation of these assets is done a build-time via `build.rs` - All new tabs are created with a user-configurable default layout, unless provided with a different layout - Plugins can now capture *all* key presses detected by Mosaic via `global_handle_key()` - Plugins can now control whether or not they are selectable via `set_selectable()` - Plugins can now fetch a vector of help-strings from Mosaic, which is currently being used to display helpful keybindings, via `get_help()` - Also patched up all remaining compiler warnings and 23 of the 25 clippy lints on main
Diffstat (limited to 'src/errors.rs')
-rw-r--r--src/errors.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/errors.rs b/src/errors.rs
index e53bbc30..cb483bbc 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -166,6 +166,7 @@ pub enum ScreenContext {
ClearScroll,
CloseFocusedPane,
ToggleActiveTerminalFullscreen,
+ SetSelectable,
ClosePane,
ApplyLayout,
NewTab,
@@ -200,6 +201,7 @@ impl From<&ScreenInstruction> for ScreenContext {
ScreenInstruction::ToggleActiveTerminalFullscreen => {
ScreenContext::ToggleActiveTerminalFullscreen
}
+ ScreenInstruction::SetSelectable(..) => ScreenContext::SetSelectable,
ScreenInstruction::ClosePane(_) => ScreenContext::ClosePane,
ScreenInstruction::ApplyLayout(_) => ScreenContext::ApplyLayout,
ScreenInstruction::NewTab(_) => ScreenContext::NewTab,
@@ -244,6 +246,7 @@ pub enum PluginContext {
Load,
Draw,
Input,
+ GlobalInput,
Unload,
Quit,
}
@@ -254,6 +257,7 @@ impl From<&PluginInstruction> for PluginContext {
PluginInstruction::Load(..) => PluginContext::Load,
PluginInstruction::Draw(..) => PluginContext::Draw,
PluginInstruction::Input(..) => PluginContext::Input,
+ PluginInstruction::GlobalInput(_) => PluginContext::GlobalInput,
PluginInstruction::Unload(_) => PluginContext::Unload,
PluginInstruction::Quit => PluginContext::Quit,
}
@@ -262,6 +266,8 @@ impl From<&PluginInstruction> for PluginContext {
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum AppContext {
+ GetState,
+ SetState,
Exit,
Error,
}
@@ -269,6 +275,8 @@ pub enum AppContext {
impl From<&AppInstruction> for AppContext {
fn from(app_instruction: &AppInstruction) -> Self {
match *app_instruction {
+ AppInstruction::GetState(_) => AppContext::GetState,
+ AppInstruction::SetState(_) => AppContext::SetState,
AppInstruction::Exit => AppContext::Exit,
AppInstruction::Error(_) => AppContext::Error,
}