diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-11-13 16:39:06 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-11-13 16:39:06 -0500 |
commit | 689e337b5a1baff0e9fe4b65e0f26601601f0ddd (patch) | |
tree | 859cbead0b0dc1d8e84b1ee041278ab75544c1d0 /src | |
parent | 57ee8da77b3f8a0a265544b9f2cb6fbb247ccc3b (diff) | |
download | nbsh-689e337b5a1baff0e9fe4b65e0f26601601f0ddd.tar.gz nbsh-689e337b5a1baff0e9fe4b65e0f26601601f0ddd.zip |
fix some bugs with input and display of exited processes when focused
Diffstat (limited to 'src')
-rw-r--r-- | src/history.rs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/history.rs b/src/history.rs index 048cc1e..f886d13 100644 --- a/src/history.rs +++ b/src/history.rs @@ -132,13 +132,10 @@ impl History { key: textmode::Key, idx: usize, ) -> bool { - self.entries[idx] - .lock_arc() - .await - .input - .send(key.into_bytes()) - .await - .unwrap(); + let entry = self.entries[idx].lock_arc().await; + if entry.running() { + entry.input.send(key.into_bytes()).await.unwrap(); + } false } @@ -166,16 +163,15 @@ impl History { if used_lines > self.size.0 as usize { break; } - if used_lines == 1 { + if focused && used_lines == 1 && entry.running() { used_lines = 2; - pos = Some((self.size.0 - 1, 0)); } out.move_to( (self.size.0 as usize - used_lines).try_into().unwrap(), 0, ); entry.render(out, self.size.1, focused); - if pos.is_none() { + if focused { pos = Some(out.screen().cursor_position()); } } @@ -244,7 +240,7 @@ impl HistoryEntry { last_row = idx + 1; } } - if focused { + if focused && self.running() { last_row = std::cmp::max( last_row, screen.cursor_position().0 as usize + 1, |