summaryrefslogtreecommitdiffstats
path: root/src/bin
diff options
context:
space:
mode:
authorClement Tsang <34804052+ClementTsang@users.noreply.github.com>2020-09-09 21:51:52 -0400
committerGitHub <noreply@github.com>2020-09-09 21:51:52 -0400
commitc58b2c2bb9b0013d4f0fddbf39df5c7a6efa9bc4 (patch)
treede70c812920489228ca463c120b735fc855b5600 /src/bin
parentc426b0c7c4b30b09a63cfdcd3bb41a7d7d9ad00c (diff)
refactor: rewrite column algorithm (#227)
Update how we position and generate column widths to look less terrible. This also adds truncation w/ ellipsis to the columns, and for processes, the state will automatically shrink to a short form (just a character) if there isn't enough space.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/main.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bin/main.rs b/src/bin/main.rs
index dd1cbabe..92cf9f0c 100644
--- a/src/bin/main.rs
+++ b/src/bin/main.rs
@@ -106,6 +106,7 @@ fn main() -> Result<()> {
termination_hook();
})
.unwrap();
+ let mut first_run = true;
while !is_terminated.load(Ordering::SeqCst) {
if let Ok(recv) = receiver.recv_timeout(Duration::from_millis(TICK_RATE_IN_MILLISECONDS)) {
@@ -123,6 +124,13 @@ fn main() -> Result<()> {
BottomEvent::Update(data) => {
app.data_collection.eat_data(&data);
+ // This thing is required as otherwise, some widgets can't draw correctly w/o
+ // some data (or they need to be re-drawn).
+ if first_run {
+ first_run = false;
+ app.is_force_redraw = true;
+ }
+
if !app.is_frozen {
// Convert all data into tui-compliant components