mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-23 21:55:11 +02:00
bug: hide user column for non-unix
This commit is contained in:
parent
b65a910257
commit
01574c8afe
@ -326,8 +326,12 @@ impl ProcWidget {
|
|||||||
pub const WPS: usize = 5;
|
pub const WPS: usize = 5;
|
||||||
pub const T_READ: usize = 6;
|
pub const T_READ: usize = 6;
|
||||||
pub const T_WRITE: usize = 7;
|
pub const T_WRITE: usize = 7;
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
pub const USER: usize = 8;
|
pub const USER: usize = 8;
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
pub const STATE: usize = 9;
|
pub const STATE: usize = 9;
|
||||||
|
#[cfg(not(target_family = "unix"))]
|
||||||
|
pub const STATE: usize = 8;
|
||||||
|
|
||||||
pub fn init(
|
pub fn init(
|
||||||
mode: ProcWidgetMode, is_case_sensitive: bool, is_match_whole_word: bool,
|
mode: ProcWidgetMode, is_case_sensitive: bool, is_match_whole_word: bool,
|
||||||
@ -375,6 +379,7 @@ impl ProcWidget {
|
|||||||
TableComponentColumn::new_hard(ProcWidgetColumn::WritePerSecond, 8),
|
TableComponentColumn::new_hard(ProcWidgetColumn::WritePerSecond, 8),
|
||||||
TableComponentColumn::new_hard(ProcWidgetColumn::TotalRead, 8),
|
TableComponentColumn::new_hard(ProcWidgetColumn::TotalRead, 8),
|
||||||
TableComponentColumn::new_hard(ProcWidgetColumn::TotalWrite, 8),
|
TableComponentColumn::new_hard(ProcWidgetColumn::TotalWrite, 8),
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
TableComponentColumn::new_soft(ProcWidgetColumn::User, Some(0.05)),
|
TableComponentColumn::new_soft(ProcWidgetColumn::User, Some(0.05)),
|
||||||
TableComponentColumn::new_hard(ProcWidgetColumn::State, 7),
|
TableComponentColumn::new_hard(ProcWidgetColumn::State, 7),
|
||||||
];
|
];
|
||||||
@ -952,6 +957,7 @@ impl ProcWidget {
|
|||||||
*is_count = !*is_count;
|
*is_count = !*is_count;
|
||||||
|
|
||||||
if *is_count {
|
if *is_count {
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
self.hide_column(Self::USER);
|
self.hide_column(Self::USER);
|
||||||
self.hide_column(Self::STATE);
|
self.hide_column(Self::STATE);
|
||||||
self.mode = ProcWidgetMode::Grouped;
|
self.mode = ProcWidgetMode::Grouped;
|
||||||
@ -961,6 +967,7 @@ impl ProcWidget {
|
|||||||
.current_scroll_position
|
.current_scroll_position
|
||||||
.clamp(0, self.num_enabled_columns().saturating_sub(1));
|
.clamp(0, self.num_enabled_columns().saturating_sub(1));
|
||||||
} else {
|
} else {
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
self.show_column(Self::USER);
|
self.show_column(Self::USER);
|
||||||
self.show_column(Self::STATE);
|
self.show_column(Self::STATE);
|
||||||
self.mode = ProcWidgetMode::Normal;
|
self.mode = ProcWidgetMode::Normal;
|
||||||
@ -1129,10 +1136,13 @@ mod test {
|
|||||||
columns[ProcWidget::T_WRITE].header,
|
columns[ProcWidget::T_WRITE].header,
|
||||||
ProcWidgetColumn::TotalWrite
|
ProcWidgetColumn::TotalWrite
|
||||||
));
|
));
|
||||||
assert!(matches!(
|
#[cfg(target_family = "unix")]
|
||||||
columns[ProcWidget::USER].header,
|
{
|
||||||
ProcWidgetColumn::User
|
assert!(matches!(
|
||||||
));
|
columns[ProcWidget::USER].header,
|
||||||
|
ProcWidgetColumn::User
|
||||||
|
));
|
||||||
|
}
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
columns[ProcWidget::STATE].header,
|
columns[ProcWidget::STATE].header,
|
||||||
ProcWidgetColumn::State
|
ProcWidgetColumn::State
|
||||||
|
Loading…
x
Reference in New Issue
Block a user