mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-12-20 23:21:36 +03:00
terminal: remove a process verbosity entry by sending just ProcessId
This commit is contained in:
parent
f0ba792f6e
commit
1e06129c3e
@ -186,7 +186,7 @@ impl State {
|
||||
execute!(
|
||||
self.stdout,
|
||||
cursor::MoveTo(0, row + 1),
|
||||
Print("To set process verbosity, input '<ProcessId> <verbosity (u8)>' and press <Enter>\n\r"),
|
||||
Print("To set process verbosity, input '<ProcessId> <verbosity (u8)>' and then press <Enter>\n\r e.g.\n\r chat:chat:template.os 3\n\rTo mute a process, input '<ProcessId> m' or 'mute' or 'muted' and then press <Enter>.\n\rTo remove a previously set process verbosity, input '<ProcessId>' and then press <Enter>.\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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user