summaryrefslogtreecommitdiffstats
path: root/src/env.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-01-03 10:41:54 -0500
committerJesse Luehrs <doy@tozt.net>2022-01-03 10:41:54 -0500
commit5b75e39514b75696fd812e711e59ce1b53b8b412 (patch)
treeff207933fa9a672457c686d52a95e3a42b455ff7 /src/env.rs
parent39f1b8bec3891b3fcc7f60aea86e2ab2f8c3ea8a (diff)
downloadnbsh-5b75e39514b75696fd812e711e59ce1b53b8b412.tar.gz
nbsh-5b75e39514b75696fd812e711e59ce1b53b8b412.zip
refocus the readline when the foreground process is suspended
Diffstat (limited to 'src/env.rs')
-rw-r--r--src/env.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/env.rs b/src/env.rs
index f78b790..7b1d79c 100644
--- a/src/env.rs
+++ b/src/env.rs
@@ -9,6 +9,7 @@ pub enum Env {
#[derive(serde::Serialize, serde::Deserialize)]
pub struct V0 {
pipeline: Option<String>,
+ idx: usize,
#[serde(
serialize_with = "serialize_status",
deserialize_with = "deserialize_status"
@@ -17,9 +18,10 @@ pub struct V0 {
}
impl Env {
- pub fn new() -> Self {
+ pub fn new(idx: usize) -> Self {
Self::V0(V0 {
pipeline: None,
+ idx,
latest_status: std::process::ExitStatus::from_raw(0),
})
}
@@ -32,6 +34,12 @@ impl Env {
}
}
+ pub fn idx(&self) -> usize {
+ match self {
+ Self::V0(env) => env.idx,
+ }
+ }
+
pub fn set_status(&mut self, status: async_std::process::ExitStatus) {
match self {
Self::V0(env) => {