diff --git a/kinode/src/terminal/mod.rs b/kinode/src/terminal/mod.rs index 7ba4dba5..966c615b 100644 --- a/kinode/src/terminal/mod.rs +++ b/kinode/src/terminal/mod.rs @@ -186,7 +186,7 @@ impl State { execute!( self.stdout, cursor::MoveTo(0, row + 1), - Print("To set process verbosity, input ' ' and press \n\r"), + Print("To set process verbosity, input ' ' and then press \n\r e.g.\n\r chat:chat:template.os 3\n\rTo mute a process, input ' m' or 'mute' or 'muted' and then press .\n\rTo remove a previously set process verbosity, input '' and then press .\n\r"), Print("Press CTRL+W to exit\n\r"), )?; @@ -1012,13 +1012,14 @@ async fn handle_key_event( if let Some((process_id, verbosity)) = State::parse_process_verbosity(¤t_line.line) { + // add ProcessId let old_verbosity = state.process_verbosity .insert(process_id.clone(), verbosity.clone()) .and_then(|ov| ov.get_verbosity().map(|ov| ov.clone())) .unwrap_or_default(); let verbosity = verbosity .get_verbosity() - .map(|ov| ov.clone()) + .map(|v| v.clone()) .unwrap_or_default(); if (old_verbosity == 3 && verbosity != 3) || (verbosity == 3 && old_verbosity != 3) { debug_event_loop @@ -1030,6 +1031,24 @@ async fn handle_key_event( current_line.line_col = 0; current_line.cursor_col = 0; state.display_process_verbosity()?; + } else if let Ok(process_id) = ¤t_line.line.parse() { + // remove ProcessId + if let Some(old_verbosity) = state.process_verbosity.remove(&process_id) { + let old_verbosity = old_verbosity + .get_verbosity() + .map(|ov| ov.clone()) + .unwrap_or_default(); + if old_verbosity == 3 { + debug_event_loop + .send(DebugCommand::ToggleEventLoopForProcess(process_id.clone())) + .await + .expect("failed to toggle process-level full event loop on"); + } + } + current_line.line.clear(); + current_line.line_col = 0; + current_line.cursor_col = 0; + state.display_process_verbosity()?; } return Ok(Some(false)); }