Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
38 changes: 19 additions & 19 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ impl App {

let csv_table_state = CsvTableState::new(
original_filename,
rows_view.headers().len(),
rows_view.raw_headers().len(),
&echo_column,
ignore_case,
color_columns,
Expand Down Expand Up @@ -696,7 +696,7 @@ impl App {
}

self.csv_table_state
.set_total_cols(self.rows_view.headers().len());
.set_total_cols(self.rows_view.raw_headers().len());

if let Some(f) = &self.finder {
// TODO: need to create a new finder every time?
Expand Down Expand Up @@ -1340,7 +1340,7 @@ mod tests {
"4 │ 71 48 0 Worcester │ ",
"5 │ 89 46 11 Wisconsin Dells │ ",
"───┴─────────────────────────────────────────────┴──────────────────────────────",
"stdin [Row 1/128, Col 1/4] [Filter \"Lon|City\": 4/10 cols] ",
"stdin [Row 1/128, Col 5/10] [Filter \"Lon|City\": 1/4 cols] ",
];
let actual_buffer = terminal.backend().buffer().clone();
let lines = to_lines(&actual_buffer);
Expand Down Expand Up @@ -1370,7 +1370,7 @@ mod tests {
" │ │ ",
" │ │ ",
"───┴───────────┴────────────────────────────────────────────────────────────────",
"stdin [Row 1/2, Col 1/1] [Filter \"COL2\": 1/2 cols] ",
"stdin [Row 1/2, Col 2/2] [Filter \"COL2\": 1/1 cols] ",
];
let actual_buffer = terminal.backend().buffer().clone();
let lines = to_lines(&actual_buffer);
Expand Down Expand Up @@ -1433,7 +1433,7 @@ mod tests {
"4 │ Worcester MA │ ",
"5 │ Wisconsin Dells WI │ ",
"───┴──────────────────────────────┴─────────────────────────────────────────────",
"stdin [Row 1/128, Col 1/2] [Filter \"(?i)city|state|wa\": 2/10 cols] [ignore-case]",
"stdin [Row 1/128, Col 9/10] [Filter \"(?i)city|state|wa\": 1/2 cols] [ignore-case]",
];
let actual_buffer = terminal.backend().buffer().clone();
let lines = to_lines(&actual_buffer);
Expand Down Expand Up @@ -2022,7 +2022,7 @@ mod tests {
" │ │ ",
" │ │ ",
"────┴────────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────",
"stdin [Row 97/128, Col 1/1] [Filter \"Salt Lake City\": 1/1] [Filter \"City\": 1/10 cols] ",
"stdin [Row 97/128, Col 9/10] [Filter \"Salt Lake City\": 1/1] [Filter \"City\": 1/1 cols] ",
];
let actual_buffer = terminal.backend().buffer().clone();
let lines = to_lines(&actual_buffer);
Expand Down Expand Up @@ -2164,7 +2164,7 @@ mod tests {
"4 │ 42 … 12 N 71 48 0 W Worce… ",
"5 │ 43 … 48 N 89 46 11 W Wisco… ",
"───┴────────────────────────────────────────────────────────────────────────────",
"stdin [Row 1/128, Col 1/10] ",
"stdin [Row 1/128, Col 2/10] ",
];
assert_eq!(lines, expected);

Expand All @@ -2187,7 +2187,7 @@ mod tests {
"4 │ 42 … 12 │ ",
"5 │ 43 … 48 │ ",
"───┴──────────────────────────────┴─────────────────────────────────────────────",
"stdin [Row 1/128, Col 1/3] [Filter \"Lat\": 3/10 cols] ",
"stdin [Row 1/128, Col 2/10] [Filter \"Lat\": 2/3 cols] ",
];
assert_eq!(lines, expected);

Expand All @@ -2205,7 +2205,7 @@ mod tests {
"4 │ 42 16 12 N 71 48 0 W Worcester ",
"5 │ 43 37 48 N 89 46 11 W Wisconsin… ",
"───┴────────────────────────────────────────────────────────────────────────────",
"stdin [Row 1/128, Col 1/10] ",
"stdin [Row 1/128, Col 2/10] ",
];
assert_eq!(lines, expected);
}
Expand Down Expand Up @@ -2239,7 +2239,7 @@ mod tests {
"125 │ 50 25 11 N 104 39 0 W Regina SA │ ",
"124 │ 39 31 12 N 119 48 35 W Reno NV │ ",
"─────┴─────────────────────────────────────────────────────────────────────────────────────┴────────",
"stdin [Row 128/128, Col 1/10] ",
"stdin [Row 128/128, Col 9/10] ",
];
assert_eq!(lines, expected);

Expand All @@ -2258,7 +2258,7 @@ mod tests {
"4 │ 42 16 12 N 71 48 0 W Worcester MA │ ",
"5 │ 43 37 48 N 89 46 11 W Wisconsin Dells WI │ ",
"───┴──────────────────────────────────────────────────────────────────────────────────────────┴─────",
"stdin [Row 1/128, Col 1/10] ",
"stdin [Row 1/128, Col 9/10] ",
];
assert_eq!(lines, expected);
}
Expand Down Expand Up @@ -2413,7 +2413,7 @@ mod tests {
"93 │ 32 42 35 San Diego │ ",
"91 │ 37 46 47 San Francisco │ ",
"────┴────────────────────────────────────────────┴──────────────────────────────",
"stdin [Row 96/128, Col 1/4] [Filter \"San\": 1/11] [Filter \"Lat|City\": 4/10 cols] ",
"stdin [Row 96/128, Col 1/10] [Filter \"San\": 1/11] [Filter \"Lat|City\": 1/4 cols] ",
];
assert_eq!(lines, expected);

Expand All @@ -2434,7 +2434,7 @@ mod tests {
"89 │ 33 45 35 Santa Ana │ ",
"92 │ 41 27 0 Sandusky │ ",
"────┴───────────────────────────────────────────┴───────────────────────────────",
"stdin [Row 86/128, Col 1/4] [Filter \"San\": -/11] [Filter \"Lat|City\": 4/10 cols] ",
"stdin [Row 86/128, Col 9/10] [Filter \"San\": -/11] [Filter \"Lat|City\": 4/4 cols] ",
];
assert_eq!(lines, expected);
}
Expand Down Expand Up @@ -2494,7 +2494,7 @@ mod tests {
"4 │ 42 16 12 │ ",
"5 │ 43 37 48 │ ",
"───┴──────────────────────────┴─────────────────────────────────────────────────",
"stdin [Row 1/128, Col 1/3] [Filter \"Lat\": 3/10 cols] ",
"stdin [Row 1/128, Col 1/10] [Filter \"Lat\": 1/3 cols] ",
];
let actual_buffer = terminal.backend().buffer().clone();
let lines = to_lines(&actual_buffer);
Expand Down Expand Up @@ -2557,7 +2557,7 @@ mod tests {
"12 │ 41 15 0 N 77 0 0 W Williams… ",
"20 │ 31 13 11 N 82 20 59 W Waycross ",
"────┴───────────────────────────────────────────────────────────────────────────",
"stdin [Row 4/128, Col 1/10] [Filter \"^1\" in LatM: -/19] ",
"stdin [Row 4/128, Col 2/10] [Filter \"^1\" in LatM: -/19] ",
];
assert_eq!(lines, expected);
}
Expand Down Expand Up @@ -2595,7 +2595,7 @@ mod tests {
"65 │ 11 N 83 48 35 W Springfield OH │ ",
"92 │ 0 N 82 42 35 W Sandusky OH │ ",
"────┴───────────────────────────────────────────────────────────────────────┴───",
"stdin [Row 1/128, Col 3/10] [Filter \"^OH$\" in State: 1/6] ",
"stdin [Row 1/128, Col 10/10] [Filter \"^OH$\" in State: 1/6] ",
];
assert_eq!(lines, expected);
}
Expand Down Expand Up @@ -2804,7 +2804,7 @@ mod tests {
" │ │ ",
" │ │ ",
"───┴──────────┴───────────────────────────────────",
"stdin [Row 1/2, Col 1/1] [Filter \"x1\": 1/1] [Filte",
"stdin [Row 1/2, Col 1/2] [Filter \"x1\": 1/1] [Filte",
];
let actual_buffer = terminal.backend().buffer().clone();
let lines = to_lines(&actual_buffer);
Expand Down Expand Up @@ -2841,7 +2841,7 @@ mod tests {
"4 │ 42 16 ║ W Worcester MA ",
"5 │ 43 37 ║ W Wisconsi… WI ",
"───┴────────────────╨─────────────────────────────",
"stdin [Row 1/128, Col 6/10] ",
"stdin [Row 1/128, Col 8/10] ",
];
assert_eq!(lines, expected);
}
Expand Down Expand Up @@ -2872,7 +2872,7 @@ mod tests {
"4 │ N Worcester MA │ ",
"5 │ N Wisconsin Dells WI │ ",
"───┴────────────────────────────────────┴─────────",
"Select your city! [Row 1/128, Col 1/3] [Filter \"NS",
"Select your city! [Row 1/128, Col 4/10] [Filter \"N",
];
assert_eq!(lines, expected);
}
Expand Down
6 changes: 0 additions & 6 deletions src/columns_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pub struct ColumnsFilter {
indices: Vec<usize>,
filtered_headers: Vec<String>,
filtered_flags: Vec<bool>,
num_columns_before_filter: usize,
disabled_because_no_match: bool,
}

Expand Down Expand Up @@ -37,7 +36,6 @@ impl ColumnsFilter {
indices,
filtered_headers,
filtered_flags,
num_columns_before_filter: headers.len(),
disabled_because_no_match,
}
}
Expand All @@ -58,10 +56,6 @@ impl ColumnsFilter {
self.indices.len()
}

pub fn num_original(&self) -> usize {
self.num_columns_before_filter
}

pub fn disabled_because_no_match(&self) -> bool {
self.disabled_because_no_match
}
Expand Down
Loading