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" {
// always give ID a couple of extra for indicator
widths[i] += self.config.uda_selection_indicator.as_str().graphemes(true).count();
if let TableMode::MultipleSelection = self.task_table_state.mode() {
widths[i] += 2
};
// if let TableMode::MultipleSelection = self.task_table_state.mode() {
// widths[i] += 2
// };
}
}

View file

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