summaryrefslogtreecommitdiffstats
path: root/src/context
diff options
context:
space:
mode:
authorJeff Zhao <jeff.no.zhao@gmail.com>2021-08-18 15:44:26 -0400
committerJeff Zhao <jeff.no.zhao@gmail.com>2021-08-18 15:44:26 -0400
commitf8851c7f9ac22289e473a2911611958e361befdc (patch)
tree5f1ea05eb677aede45eb12a877882a7c2ff23a3d /src/context
parent45e7a9f8cc3937ed21006fb4a5d5145426f70558 (diff)
add quit_to_cwd command
- this command lets users exit to the current directory more easily and more ergonomically
Diffstat (limited to 'src/context')
-rw-r--r--src/context/app_context.rs12
-rw-r--r--src/context/mod.rs2
2 files changed, 11 insertions, 3 deletions
diff --git a/src/context/app_context.rs b/src/context/app_context.rs
index 5c206e5..112b63b 100644
--- a/src/context/app_context.rs
+++ b/src/context/app_context.rs
@@ -6,8 +6,16 @@ use crate::context::{LocalStateContext, PreviewContext, TabContext, WorkerContex
use crate::event::{AppEvent, Events};
use crate::util::search::SearchPattern;
+#[derive(Clone, Copy, Debug, PartialEq)]
+pub enum QuitType {
+ DoNot,
+ Normal,
+ Force,
+ ToCurrentDirectory,
+}
+
pub struct AppContext {
- pub exit: bool,
+ pub quit: QuitType,
// event loop querying
pub events: Events,
// app config
@@ -31,7 +39,7 @@ impl AppContext {
let events = Events::new();
let event_tx = events.event_tx.clone();
Self {
- exit: false,
+ quit: QuitType::DoNot,
events,
tab_context: TabContext::new(),
local_state: None,
diff --git a/src/context/mod.rs b/src/context/mod.rs
index 0a5f6c2..3ba9a56 100644
--- a/src/context/mod.rs
+++ b/src/context/mod.rs
@@ -4,7 +4,7 @@ mod preview_context;
mod tab_context;
mod worker_context;
-pub use self::app_context::AppContext;
+pub use self::app_context::{AppContext, QuitType};
pub use self::local_state::LocalStateContext;
pub use self::preview_context::PreviewContext;
pub use self::tab_context::TabContext;