@@ -505,19 +505,41 @@ impl ProcessList { |
| 505 | 505 | // PID |
| 506 | 506 | renderer.text(&process.pid.to_string(), col_pid, text_y, &dim_style)?; |
| 507 | 507 | |
| 508 | | - // Name with tree prefix |
| 508 | + // Container indicator prefix |
| 509 | + let container_prefix = process.container.as_ref().map(|c| { |
| 510 | + if c.starts_with("docker:") { "🐳" } |
| 511 | + else if c.starts_with("podman:") { "🦭" } |
| 512 | + else if c.starts_with("k8s:") { "☸" } |
| 513 | + else if c.starts_with("lxc:") { "📦" } |
| 514 | + else { "" } |
| 515 | + }).unwrap_or(""); |
| 516 | + |
| 517 | + // Name with tree prefix and container indicator |
| 509 | 518 | let name_with_prefix = if tree_view && indent > 0 { |
| 510 | | - let prefix = " ".repeat(indent.saturating_sub(1)) + "├─"; |
| 511 | | - let max_name_len = 18usize.saturating_sub(prefix.len()); |
| 519 | + let tree_prefix = " ".repeat(indent.saturating_sub(1)) + "├─"; |
| 520 | + let full_prefix = if container_prefix.is_empty() { |
| 521 | + tree_prefix |
| 522 | + } else { |
| 523 | + format!("{}{}", container_prefix, tree_prefix) |
| 524 | + }; |
| 525 | + let max_name_len = 18usize.saturating_sub(full_prefix.chars().count()); |
| 512 | 526 | if process.name.len() > max_name_len { |
| 513 | | - format!("{}{:.width$}..", prefix, process.name, width = max_name_len.saturating_sub(2)) |
| 527 | + format!("{}{:.width$}..", full_prefix, process.name, width = max_name_len.saturating_sub(2)) |
| 514 | 528 | } else { |
| 515 | | - format!("{}{}", prefix, process.name) |
| 529 | + format!("{}{}", full_prefix, process.name) |
| 516 | 530 | } |
| 517 | | - } else if process.name.len() > 18 { |
| 518 | | - format!("{}...", &process.name[..15]) |
| 519 | 531 | } else { |
| 520 | | - process.name.clone() |
| 532 | + let display_name = if !container_prefix.is_empty() { |
| 533 | + format!("{}{}", container_prefix, process.name) |
| 534 | + } else { |
| 535 | + process.name.clone() |
| 536 | + }; |
| 537 | + if display_name.chars().count() > 18 { |
| 538 | + let truncated: String = display_name.chars().take(15).collect(); |
| 539 | + format!("{}...", truncated) |
| 540 | + } else { |
| 541 | + display_name |
| 542 | + } |
| 521 | 543 | }; |
| 522 | 544 | renderer.text(&name_with_prefix, col_name, text_y, &text_style)?; |
| 523 | 545 | |