T40: a session posts at each turn of its row to waiting, done or error, as the row's waiting mark is set, so one output posts as two would
CI / platforms (ubuntu-24.04) (push) Successful in 1m23s
CI / platforms (windows-latest) (push) Successful in 1m48s
CI / macos (push) Successful in 12m44s

This commit is contained in:
ZacharyZhang-NY committed 2026-10-17 15:43:12 -04:00
1 parent 3aaeb36bd1
commit efda50f142
5 files changed
+14 -22

No files matched your search

+2 -2
View File
@@ -77,8 +77,8 @@ impl TerminalView {
}
drop(term);
self.pty.write(bytes);
if self.records.seen() && self.restate(cx) {
self.tell_state(cx);
if self.records.seen() {
self.restate(cx);
}
cx.notify();
}
+6 -9
View File
@@ -122,29 +122,26 @@ impl TerminalView {
}
}
/// Notes the state its row shows, and tells the owner of a change; true when it changed.
pub(super) fn restate(&mut self, cx: &mut Context<Self>) -> bool {
let changed = self.records.restate();
if changed {
/// Notes the state its row shows; a change goes to the owner, and one to waiting, done or error posts.
pub(super) fn restate(&mut self, cx: &mut Context<Self>) {
if self.records.restate() {
let state = self.records.shows();
log::info!("terminal {}: its row shows {state:?}", self.pty.pid);
cx.emit(TerminalEvent::Shows(state));
self.tell_state(cx);
}
changed
}
/// herdr's agents in place of the last ones; an open hover reads them, so the view draws again.
pub(super) fn agents(&mut self, agents: &[(String, Record)], cx: &mut Context<Self>) {
if self.records.herdr(agents) {
if self.restate(cx) {
self.tell_state(cx);
}
self.restate(cx);
cx.notify();
}
}
/// Posts the state its row shows when it turned to waiting, done or error.
pub(super) fn tell_state(&mut self, cx: &mut Context<Self>) {
fn tell_state(&mut self, cx: &mut Context<Self>) {
let body = match self.records.shown() {
Some((id, record))
if matches!(record.state, State::Blocked | State::Done | State::Error) =>
+4 -9
View File
@@ -249,7 +249,6 @@ impl TerminalView {
let drawn = events
.iter()
.any(|event| matches!(event, PtyEvent::Term(Event::Wakeup)));
let mut restated = false;
for event in events {
match event {
PtyEvent::Folder(folder) => {
@@ -262,27 +261,23 @@ impl TerminalView {
// A new prompt ends what was working, waiting or idle; done and error stay.
PtyEvent::Mark(Mark::Prompt) => {
self.records.prompt();
restated |= self.restate(cx);
self.restate(cx);
}
PtyEvent::Mark(_) => {}
PtyEvent::Status(status) => {
self.status(status);
restated |= self.restate(cx);
self.restate(cx);
}
PtyEvent::Ask(ask) => {
self.ask(ask, cx);
restated |= self.restate(cx);
self.restate(cx);
}
PtyEvent::Reset => {
self.records.reset();
restated |= self.restate(cx);
self.restate(cx);
}
}
}
// A state a later change in the same output passed by posts nothing.
if restated {
self.tell_state(cx);
}
// ponytail: a full search per output batch while find is open; search only new lines if it lags.
if drawn && self.finder.is_some() {
self.search(false, cx);