Start boilerplate for finder

This commit is contained in:
Greg Shuflin committed 2024-04-04 01:56:12 -07:00
1 parent f8b3e2e41c
commit ac5ea7f95d
4 files changed
+18

No files matched your search

+11
View File
@@ -153,6 +153,9 @@ impl EditorCore {
info!("showing help");
self.handle_action(EditorAction::PopupHelp(toggle));
}
CommandOutput::ToggleFinder(toggle) => {
self.handle_action(EditorAction::ToggleFinder(toggle));
}
};
self.handle_action(EditorAction::TransitionToMode(Mode::Normal));
@@ -214,6 +217,14 @@ impl EditorCore {
self.pane_layout.remove(buffer_id);
}
}
ToggleFinder(toggle) => {
//TODO change this hardcoding of the buffer id
let buffer_id = BufferId(100);
if toggle {
//TODO create finder buffer
} else {
}
}
}
}
}
+3
View File
@@ -28,6 +28,9 @@ pub(crate) enum EditorAction {
/// Show or hide the popup help
PopupHelp(bool),
/// Show or hide the Finder
ToggleFinder(bool),
}
#[derive(Debug)]
+1
View File
@@ -14,6 +14,7 @@ pub(crate) enum CommandOutput {
Quit,
Error(String),
ShowHelp(bool),
ToggleFinder(bool),
}
#[derive(Debug)]
+3
View File
@@ -16,6 +16,7 @@ impl CommandAPI {
Some(s) if s == "quit" || s == "q" => Command::Quit,
Some(s) if s == "write" || s == "w" => Command::Write,
Some(s) if s == "help" || s == "h" => Command::Help,
Some(s) if s == "finder" || s == "h" => Command::Finder,
Some(other) => return Some(CommandOutput::Error(format!("Invalid command: {other}"))),
None => return None,
};
@@ -44,6 +45,7 @@ impl CommandAPI {
};
Some(CommandOutput::ShowHelp(toggle))
}
Command::Finder => Some(CommandOutput::ToggleFinder(true)),
}
}
}
@@ -54,4 +56,5 @@ enum Command {
Quit,
Write,
Help,
Finder,
}