这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions crates/turborepo-ui/src/tui/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,12 @@ impl<W> App<W> {
task.parser.screen_mut().set_scrollback(0);
Ok(())
}

pub fn clear_task_logs(&mut self) -> Result<(), Error> {
let task = self.get_full_task_mut()?;
task.clear_logs();
Ok(())
}
}

impl<W: Write> App<W> {
Expand Down Expand Up @@ -899,6 +905,9 @@ fn update(
app.scroll_momentum.reset();
app.jump_to_logs_bottom()?;
}
Event::ClearLogs => {
app.clear_task_logs()?;
}
Event::EnterInteractive => {
app.is_task_selection_pinned = true;
app.interact()?;
Expand Down
1 change: 1 addition & 0 deletions crates/turborepo-ui/src/tui/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub enum Event {
PageDown,
JumpToLogsTop,
JumpToLogsBottom,
ClearLogs,
SetStdin {
task: String,
stdin: Box<dyn std::io::Write + Send>,
Expand Down
1 change: 1 addition & 0 deletions crates/turborepo-ui/src/tui/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ fn translate_key_event(options: InputOptions, key_event: KeyEvent) -> Option<Eve
KeyCode::PageDown | KeyCode::Char('D') => Some(Event::PageDown),
KeyCode::Char('t') => Some(Event::JumpToLogsTop),
KeyCode::Char('b') => Some(Event::JumpToLogsBottom),
KeyCode::Char('C') => Some(Event::ClearLogs),
KeyCode::Char('m') => Some(Event::ToggleHelpPopup),
KeyCode::Char('p') => Some(Event::TogglePinnedTask),
KeyCode::Up | KeyCode::Char('k') => Some(Event::Up),
Expand Down
1 change: 1 addition & 0 deletions crates/turborepo-ui/src/tui/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const BIND_LIST: &[&str] = [
"d - Scroll logs down",
"Shift+u - Page logs up",
"Shift+d - Page logs down",
"Shift+c - Clear logs",
"t - Jump to top of logs",
"b - Jump to bottom of logs",
]
Expand Down
7 changes: 7 additions & 0 deletions crates/turborepo-ui/src/tui/term_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,11 @@ impl<W> TerminalOutput<W> {
pub fn copy_selection(&self) -> Option<String> {
self.parser.screen().selected_text()
}

pub fn clear_logs(&mut self) {
self.output.clear();

// clear screen and reset cursor
self.process(b"\x1bc");
}
}
Loading