Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow sorting by any column #183

Merged
merged 8 commits into from
Aug 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix minor cursor issue in search caused by wrap change
  • Loading branch information
ClementTsang committed Aug 15, 2020
commit 4a6cba69ba72d0eab4efd9ba9693602571cd5cbe
3 changes: 2 additions & 1 deletion src/app/data_harvester/processes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use std::{
#[cfg(not(target_os = "linux"))]
use sysinfo::{ProcessExt, ProcessorExt, System, SystemExt};

// TODO: Add value so we know if it's sorted ascending or descending by default?
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub enum ProcessSorting {
CpuPercent,
Expand All @@ -24,7 +25,7 @@ pub enum ProcessSorting {
WritePerSecond,
TotalRead,
TotalWrite,
State, // This one is just alphabetical
State,
}

impl std::fmt::Display for ProcessSorting {
Expand Down
2 changes: 1 addition & 1 deletion src/app/states.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ impl ProcWidgetState {
| ProcessSorting::Pid
| ProcessSorting::ProcessName
| ProcessSorting::Command => {
// Also please invert this (and any future ones that require alphabetical sorting) by default!
// Also invert anything that uses alphabetical sorting by default.
self.process_sorting_reverse = false;
}
_ => {}
Expand Down
5 changes: 2 additions & 3 deletions src/canvas/widgets/process_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use tui::{
layout::{Alignment, Constraint, Direction, Layout, Rect},
terminal::Frame,
text::{Span, Spans},
widgets::{Block, Borders, Paragraph, Row, Table, Wrap},
widgets::{Block, Borders, Paragraph, Row, Table},
};

use unicode_segmentation::{GraphemeIndices, UnicodeSegmentation};
Expand Down Expand Up @@ -490,8 +490,7 @@ impl ProcessTableWidget for Painter {
Paragraph::new(search_text)
.block(process_search_block)
.style(self.colours.text_style)
.alignment(Alignment::Left)
.wrap(Wrap { trim: false }),
.alignment(Alignment::Left),
margined_draw_loc[0],
);
}
Expand Down