Prompt now only redraws on completed jobs and new commands

Tab completion now finds env var names as well as internally set names
This commit is contained in:
2026-02-25 16:48:49 -05:00
parent df5f1d5778
commit 2d0d919e66
5 changed files with 21 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
use std::{
cell::RefCell, collections::{HashMap, HashSet, VecDeque}, fmt::Display, ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign, Deref}, os::unix::fs::PermissionsExt, str::FromStr, time::Duration
cell::RefCell, collections::{HashMap, HashSet, VecDeque, hash_map::Entry}, fmt::Display, ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign, Deref}, os::unix::fs::PermissionsExt, str::FromStr, time::Duration
};
use nix::unistd::{User, gethostname, getppid};
@@ -183,6 +183,12 @@ impl ScopeStack {
flat_vars.insert(var_name.clone(), var.clone());
}
}
for var in env::vars() {
if let Entry::Vacant(e) = flat_vars.entry(var.0) {
e.insert(Var::new(VarKind::Str(var.1), VarFlags::EXPORT));
}
}
flat_vars
}
pub fn set_var(&mut self, var_name: &str, val: &str, flags: VarFlags) -> ShResult<()> {
@@ -953,7 +959,6 @@ pub fn get_status() -> i32 {
.parse::<i32>()
.unwrap()
}
#[track_caller]
pub fn set_status(code: i32) {
write_vars(|v| v.set_param(ShellParam::Status, &code.to_string()))
}