diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-01-03 10:41:54 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-01-03 10:41:54 -0500 |
commit | 5b75e39514b75696fd812e711e59ce1b53b8b412 (patch) | |
tree | ff207933fa9a672457c686d52a95e3a42b455ff7 /src/env.rs | |
parent | 39f1b8bec3891b3fcc7f60aea86e2ab2f8c3ea8a (diff) | |
download | nbsh-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.rs | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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) => { |