summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-03-04 22:56:36 -0500
committerJesse Luehrs <doy@tozt.net>2022-03-04 22:56:36 -0500
commit85514ee5187b58d5cbae5b0631aa2d0d29cbf268 (patch)
tree89d6da7ec9ff2c743ab3cd8fa9519188a4903cf9 /src
parentc90907cbfe86d8c37428dc5b0eb83e0b1d569845 (diff)
downloadnbsh-85514ee5187b58d5cbae5b0631aa2d0d29cbf268.tar.gz
nbsh-85514ee5187b58d5cbae5b0631aa2d0d29cbf268.zip
check for new directory after handling event instead of before
Diffstat (limited to 'src')
-rw-r--r--src/shell/mod.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/shell/mod.rs b/src/shell/mod.rs
index 461e359..1027a20 100644
--- a/src/shell/mod.rs
+++ b/src/shell/mod.rs
@@ -25,11 +25,6 @@ pub async fn main() -> Result<i32> {
let mut prev_dir = shell.env.pwd().to_path_buf();
inputs.new_dir(prev_dir.clone());
while let Some(event) = event_r.recv().await {
- let dir = shell.env().pwd();
- if dir != prev_dir {
- prev_dir = dir.to_path_buf();
- inputs.new_dir(dir.to_path_buf());
- }
match shell.handle_event(event, &event_w) {
Some(Action::Refresh) => {
shell.render(&mut output)?;
@@ -47,6 +42,11 @@ pub async fn main() -> Result<i32> {
Some(Action::Quit) => break,
None => {}
}
+ let dir = shell.env().pwd();
+ if dir != prev_dir {
+ prev_dir = dir.to_path_buf();
+ inputs.new_dir(dir.to_path_buf());
+ }
}
Ok(0)