summaryrefslogtreecommitdiffstats
path: root/src/shell/history/mod.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2022-03-04 18:55:29 -0500
committerJesse Luehrs <doy@tozt.net>2022-03-04 18:55:29 -0500
commit1b87a061d8fa047eac2bc1dc93e60cd2489e477b (patch)
treee530c2490994f56e73c994ff31ee9702088ff037 /src/shell/history/mod.rs
parente1bfb9bc59a6a97594cb5c2c51cc4ca8ee813a23 (diff)
downloadnbsh-1b87a061d8fa047eac2bc1dc93e60cd2489e477b.tar.gz
nbsh-1b87a061d8fa047eac2bc1dc93e60cd2489e477b.zip
remove the mutex around exit_info
it is small enough that copying it is not really a big deal
Diffstat (limited to 'src/shell/history/mod.rs')
-rw-r--r--src/shell/history/mod.rs21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/shell/history/mod.rs b/src/shell/history/mod.rs
index df995e6..8ec9f75 100644
--- a/src/shell/history/mod.rs
+++ b/src/shell/history/mod.rs
@@ -1,8 +1,7 @@
use crate::shell::prelude::*;
mod entry;
-pub use entry::Entry;
-mod job;
+pub use entry::{Entry, ExitInfo};
mod pty;
pub struct History {
@@ -29,7 +28,7 @@ impl History {
offset: time::UtcOffset,
) {
let mut cursor = None;
- for (idx, used_lines, mut vt, state) in
+ for (idx, used_lines, mut vt) in
self.visible(repl_lines, focus, scrolling).rev()
{
let focused = focus.map_or(false, |focus| idx == focus);
@@ -41,7 +40,6 @@ impl History {
out,
idx,
self.entry_count(),
- &*state,
&mut *vt,
self.size,
focused,
@@ -83,7 +81,7 @@ impl History {
event_w: crate::shell::event::Writer,
) {
self.entries
- .push(Entry::new(cmdline, env, self.size, event_w));
+ .push(Entry::new(cmdline, env, self.size, event_w).unwrap());
}
pub fn entry_count(&self) -> usize {
@@ -144,7 +142,7 @@ impl History {
if used_lines > usize::from(self.size.0) {
break;
}
- iter.add(idx, used_lines, entry.lock_vt(), entry.lock_state());
+ iter.add(idx, used_lines, entry.lock_vt());
}
iter
}
@@ -155,7 +153,6 @@ struct VisibleEntries<'a> {
usize,
usize,
std::sync::MutexGuard<'a, pty::Vt>,
- std::sync::MutexGuard<'a, job::State>,
)>,
}
@@ -171,20 +168,14 @@ impl<'a> VisibleEntries<'a> {
idx: usize,
offset: usize,
vt: std::sync::MutexGuard<'a, pty::Vt>,
- state: std::sync::MutexGuard<'a, job::State>,
) {
// push_front because we are adding them in reverse order
- self.entries.push_front((idx, offset, vt, state));
+ self.entries.push_front((idx, offset, vt));
}
}
impl<'a> std::iter::Iterator for VisibleEntries<'a> {
- type Item = (
- usize,
- usize,
- std::sync::MutexGuard<'a, pty::Vt>,
- std::sync::MutexGuard<'a, job::State>,
- );
+ type Item = (usize, usize, std::sync::MutexGuard<'a, pty::Vt>);
fn next(&mut self) -> Option<Self::Item> {
self.entries.pop_front()