From 5b75e39514b75696fd812e711e59ce1b53b8b412 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 3 Jan 2022 10:41:54 -0500 Subject: refocus the readline when the foreground process is suspended --- src/env.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/env.rs') 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, + 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) => { -- cgit v1.2.3-54-g00ecf