Make table not shift in multiple selection mode

This commit is contained in:
Dheepak Krishnamurthy 2021-03-25 15:27:08 -06:00
parent 18e9f15851
commit 34f6dcca34
2 changed files with 8 additions and 8 deletions

View file

@ -694,9 +694,9 @@ impl TTApp {
if header == "ID" || header == "Name" { if header == "ID" || header == "Name" {
// always give ID a couple of extra for indicator // always give ID a couple of extra for indicator
widths[i] += self.config.uda_selection_indicator.as_str().graphemes(true).count(); widths[i] += self.config.uda_selection_indicator.as_str().graphemes(true).count();
if let TableMode::MultipleSelection = self.task_table_state.mode() { // if let TableMode::MultipleSelection = self.task_table_state.mode() {
widths[i] += 2 // widths[i] += 2
}; // };
} }
} }

View file

@ -368,21 +368,21 @@ where
let highlight_symbol = match state.mode { let highlight_symbol = match state.mode {
TableMode::MultipleSelection => { TableMode::MultipleSelection => {
let s = self.highlight_symbol.unwrap_or("").trim_end(); let s = self.highlight_symbol.unwrap_or("").trim_end();
format!("[{}] ", s) format!("{} ", s)
} }
TableMode::SingleSelection => self.highlight_symbol.unwrap_or("").to_string(), TableMode::SingleSelection => self.highlight_symbol.unwrap_or("").to_string(),
}; };
let mark_symbol = match state.mode { let mark_symbol = match state.mode {
TableMode::MultipleSelection => { TableMode::MultipleSelection => {
let s = self.mark_symbol.unwrap_or("").trim_end(); let s = self.mark_symbol.unwrap_or("").trim_end();
format!("[{}] ", s) format!("{} ", s)
} }
TableMode::SingleSelection => self.highlight_symbol.unwrap_or("").to_string(), TableMode::SingleSelection => self.highlight_symbol.unwrap_or("").to_string(),
}; };
let blank_symbol = match state.mode { let blank_symbol = match state.mode {
TableMode::MultipleSelection => "[ ] ".to_string(), TableMode::MultipleSelection => " ".to_string(),
TableMode::SingleSelection => iter::repeat(" ").take(highlight_symbol.width()).collect::<String>(), TableMode::SingleSelection => iter::repeat(" ").take(highlight_symbol.width()).collect::<String>(),
}; };