Skip to content

Commit

Permalink
Fix sorter column name when columns are filtered
Browse files Browse the repository at this point in the history
  • Loading branch information
YS-L committed Feb 23, 2024
1 parent 7dadca7 commit 6d30ba7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,7 @@ impl App {
if should_create_new_sorter {
let column_name = self
.rows_view
.headers()
.get(selected_column_index as usize)
.map(|h| h.name.clone())
.unwrap_or_default();
.get_column_name_global(selected_column_index as usize);
let _sorter = sort::Sorter::new(
self.shared_config.clone(),
selected_column_index as usize,
Expand Down
8 changes: 8 additions & 0 deletions src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,14 @@ impl RowsView {
self.headers[column_index].origin_index
}

pub fn get_column_name_global(&self, global_column_index: usize) -> String {
self.reader
.headers
.get(global_column_index)
.cloned()
.unwrap_or_default()
}

fn get_default_headers_from_reader(reader: &CsvLensReader) -> Vec<Header> {
reader
.headers
Expand Down

0 comments on commit 6d30ba7

Please sign in to comment.