diff options
author | rabite <rabite@posteo.de> | 2019-03-20 13:58:59 +0100 |
---|---|---|
committer | rabite <rabite@posteo.de> | 2019-03-20 13:58:59 +0100 |
commit | 9a711bbe96d753d0dbf70007adc0ff89823aa9ad (patch) | |
tree | f8c0fc8cf12967a5c1a5409b37f6800a050a5c27 /src/proclist.rs | |
parent | c2297ab4945d010d4106d35a34ec83314891c34f (diff) |
handle long lines in status/footer
Diffstat (limited to 'src/proclist.rs')
-rw-r--r-- | src/proclist.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/proclist.rs b/src/proclist.rs index bab9394..a841b44 100644 --- a/src/proclist.rs +++ b/src/proclist.rs @@ -12,6 +12,7 @@ use crate::listview::{Listable, ListView}; use crate::textview::TextView; use crate::widget::{Widget, Events, WidgetCore}; use crate::coordinates::Coordinates; +use crate::dirty::Dirtyable; use crate::hbox::HBox; use crate::preview::WillBeWidget; use crate::fail::{HResult, HError, ErrorLog}; @@ -90,12 +91,11 @@ impl Process { format!("{}{}", term::color_red(), proc_status) }; - let status = format!("Process: {}:{} exited {}{}{} with status: {}", + let status = format!("Process: {}:{} exited {}{} with status: {}", cmd, pid, color_success, - term::reset(), - term::status_bg(), + term::normal_color(), color_status); sender.send(Events::Status(status))?; } @@ -113,6 +113,10 @@ impl Listable for ListView<Vec<Process>> { self.render_proc(proc).unwrap() }).collect() } + fn on_refresh(&mut self) -> HResult<()> { + self.core.set_dirty(); + Ok(()) + } } impl ListView<Vec<Process>> { @@ -385,6 +389,7 @@ impl Widget for ProcView { fn render_footer(&self) -> HResult<String> { let listview = self.get_listview(); let selection = listview.get_selection(); + let xsize = self.core.coordinates.xsize_u(); if let Some(proc) = listview.content.get(selection) { let cmd = &proc.cmd; @@ -409,7 +414,7 @@ impl Widget for ProcView { } } else { "wtf".to_string() }; - let procinfo = format!("Process: {}:{} exited {}{}{} with status: {}", + let procinfo = format!("{}:{} exited {}{}{} with status: {}", cmd, pid, color_success, @@ -419,7 +424,7 @@ impl Widget for ProcView { procinfo } else { "still running".to_string() }; - let footer = format!("{}: {}", cmd, procinfo); + let footer = term::sized_string_u(&procinfo, xsize); Ok(footer) } else { Ok("No proccesses".to_string()) } |