mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
decrease TUI to only draw 10 frames on idle.
add tracing when a cmd is entered
This commit is contained in:
parent
37eaa3f85a
commit
5f15555fc5
@ -12,7 +12,7 @@ use std::{
|
|||||||
},
|
},
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
use tracing::{error, info, warn};
|
use tracing::{debug, error, info, warn};
|
||||||
use tui::{
|
use tui::{
|
||||||
backend::CrosstermBackend,
|
backend::CrosstermBackend,
|
||||||
layout::Rect,
|
layout::Rect,
|
||||||
@ -93,6 +93,7 @@ impl Tui {
|
|||||||
input.pop();
|
input.pop();
|
||||||
},
|
},
|
||||||
KeyCode::Enter => {
|
KeyCode::Enter => {
|
||||||
|
debug!(?input, "tui mode: command entered");
|
||||||
parse_command(input, msg_s);
|
parse_command(input, msg_s);
|
||||||
|
|
||||||
*input = String::new();
|
*input = String::new();
|
||||||
@ -115,11 +116,12 @@ impl Tui {
|
|||||||
if basic {
|
if basic {
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
while running.load(Ordering::Relaxed) {
|
while running.load(Ordering::Relaxed) {
|
||||||
let mut buf = String::new();
|
let mut line = String::new();
|
||||||
|
|
||||||
io::stdin().read_line(&mut buf).unwrap();
|
io::stdin().read_line(&mut line).unwrap();
|
||||||
|
debug!(?line, "basic mode: command entered");
|
||||||
|
|
||||||
parse_command(&buf, &mut msg_s);
|
parse_command(&line, &mut msg_s);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -182,7 +184,7 @@ impl Tui {
|
|||||||
}) {
|
}) {
|
||||||
warn!(?e, "couldn't draw frame");
|
warn!(?e, "couldn't draw frame");
|
||||||
};
|
};
|
||||||
if crossterm::event::poll(Duration::from_millis(10)).unwrap() {
|
if crossterm::event::poll(Duration::from_millis(100)).unwrap() {
|
||||||
Self::handle_events(&mut input, &mut msg_s);
|
Self::handle_events(&mut input, &mut msg_s);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user