Fix incorrect marks

This commit is contained in:
Dheepak Krishnamurthy 2021-03-23 22:00:35 -06:00
parent ae2fc084c6
commit dd3bf47cae
2 changed files with 13 additions and 4 deletions

View file

@ -242,6 +242,15 @@ impl TTApp {
}
}
pub fn draw_debug(&mut self, f: &mut Frame<impl Backend>) {
let area = centered_rect(50, 50, f.size());
f.render_widget(Clear, area);
let t = format!("{:?}", self.marked);
let p = Paragraph::new(Text::from(t))
.block(Block::default().borders(Borders::ALL).border_type(BorderType::Rounded));
f.render_widget(p, area);
}
pub fn draw_calendar(&mut self, f: &mut Frame<impl Backend>) {
let dates_with_styles = self.get_dates_with_styles();
let rects = Layout::default()
@ -819,7 +828,6 @@ impl TTApp {
self.export_contexts()?;
self.update_tags();
}
self.update_task_table_state();
Ok(())
}
@ -1934,6 +1942,7 @@ impl TTApp {
}
}
}
self.update_task_table_state();
Ok(())
}
}

View file

@ -410,7 +410,7 @@ where
{
match state.mode {
TableMode::MultipleSelection => {
if state.marked.contains(&i) {
if state.marked.contains(&(i + state.offset)) {
(d, highlight_style, mark_symbol.to_string())
} else {
(d, highlight_style, blank_symbol.to_string())
@ -420,14 +420,14 @@ where
}
}
Row::Data(d) => {
if state.marked.contains(&i) {
if state.marked.contains(&(i + state.offset)) {
(d, default_style, mark_symbol.to_string())
} else {
(d, default_style, blank_symbol.to_string())
}
}
Row::StyledData(d, s) => {
if state.marked.contains(&i) {
if state.marked.contains(&(i + state.offset)) {
(d, s, mark_symbol.to_string())
} else {
(d, s, blank_symbol.to_string())