summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2019-10-29 10:14:46 +0200
committerManos Pitsidianakis <el13635@mail.ntua.gr>2019-10-29 10:14:53 +0200
commitcde545a6abc64aa9a85463c189d4ffe1d7f9bdc7 (patch)
tree670f036807da70e7d5a59e8d73f5702d6fc9a46a
parent5d062551afa89a30d88d0f9ef0d8c0b27c8d9da1 (diff)
Tighten row highlight colours area bounds
There was some "spillover" color to the next row in cases with long cmd_line strings.
-rw-r--r--src/ui/components/processes.rs32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/ui/components/processes.rs b/src/ui/components/processes.rs
index 2798d43..6de4b9e 100644
--- a/src/ui/components/processes.rs
+++ b/src/ui/components/processes.rs
@@ -511,7 +511,7 @@ impl ProcessList {
let p = &self.processes[self.data.processes_index[pid]];
match executable_path_color(&p.cmd_line) {
Ok((path, bin, rest)) => {
- let (x, y) = write_string_to_grid(
+ let (x, _) = write_string_to_grid(
&format!(
"{pid:>max_pid$} {ppid:>max_ppid$} {username:>max_username$} {vm_rss:>max_vm_rss$} {cpu_percent:>max_cpu_percent$}% {state:>max_state$} {branches}",
pid = p.pid,
@@ -576,7 +576,7 @@ impl ProcessList {
(pos_inc(upper_left, (x - 1, y_offset + 2)), bottom_right),
false,
);
- let (x, _) = write_string_to_grid(
+ write_string_to_grid(
rest,
grid,
fg_color,
@@ -587,7 +587,10 @@ impl ProcessList {
);
change_colors(
grid,
- ((x, y), set_y(bottom_right, y)),
+ (
+ pos_inc(upper_left, (x - 1 + rest.len(), y_offset + 2)),
+ set_y(bottom_right, get_y(upper_left) + y_offset + 2),
+ ),
Some(fg_color),
Some(bg_color),
);
@@ -650,7 +653,7 @@ impl ProcessList {
(pos_inc(upper_left, (x - 1, y_offset + 2)), bottom_right),
false,
);
- let (x, y) = write_string_to_grid(
+ write_string_to_grid(
rest,
grid,
fg_color,
@@ -661,7 +664,10 @@ impl ProcessList {
);
change_colors(
grid,
- ((x, y), set_y(bottom_right, y)),
+ (
+ pos_inc(upper_left, (x - 1 + rest.len(), y_offset + 2)),
+ set_y(bottom_right, get_y(upper_left) + y_offset + 2),
+ ),
Some(fg_color),
Some(bg_color),
);
@@ -969,7 +975,7 @@ impl Component for ProcessList {
match executable_path_color(&p.cmd_line) {
Ok((path, bin, rest)) => {
- let (x, y) = write_string_to_grid(
+ let (x, _) = write_string_to_grid(
&format!(
"{pid:>max_pid$} {ppid:>max_ppid$} {username:>max_username$} {vm_rss:>max_vm_rss$} {cpu_percent:>max_cpu_percent$}% {state:>max_state$} ",
pid = p.pid,
@@ -1033,7 +1039,7 @@ impl Component for ProcessList {
(pos_inc(upper_left, (x - 1, y_offset + 2)), bottom_right),
false,
);
- let (x, _) = write_string_to_grid(
+ write_string_to_grid(
rest,
grid,
fg_color,
@@ -1044,7 +1050,10 @@ impl Component for ProcessList {
);
change_colors(
grid,
- ((x, y), set_y(bottom_right, y)),
+ (
+ pos_inc(upper_left, (x - 1 + rest.len(), y_offset + 2)),
+ set_y(bottom_right, get_y(upper_left) + y_offset + 2),
+ ),
Some(fg_color),
Some(bg_color),
);
@@ -1106,7 +1115,7 @@ impl Component for ProcessList {
(pos_inc(upper_left, (x - 1, y_offset + 2)), bottom_right),
false,
);
- let (x, y) = write_string_to_grid(
+ write_string_to_grid(
rest,
grid,
fg_color,
@@ -1117,7 +1126,10 @@ impl Component for ProcessList {
);
change_colors(
grid,
- ((x, y), set_y(bottom_right, y)),
+ (
+ pos_inc(upper_left, (x - 1 + rest.len(), y_offset + 2)),
+ set_y(bottom_right, get_y(upper_left) + y_offset + 2),
+ ),
Some(fg_color),
Some(bg_color),
);