Add functionality for 'select all'

This commit is contained in:
Ian Keane 2025-11-23 12:05:10 -05:00
parent 5aaa57a6a2
commit 8534fa4988
2 changed files with 20 additions and 1 deletions

View file

@ -39,6 +39,7 @@ pub enum LogViewSelection {
Entry, // Individual entry selected Entry, // Individual entry selected
Project, // Whole project selected (ByProject mode only) Project, // Whole project selected (ByProject mode only)
Day, // Whole day selected Day, // Whole day selected
All, // Entire view/period selected
} }
pub struct App { pub struct App {
@ -373,6 +374,9 @@ impl App {
// Jump to next day // Jump to next day
self.jump_to_next_day(); self.jump_to_next_day();
} }
LogViewSelection::All => {
// No navigation at All level - already selecting everything
}
} }
} }
KeyCode::Char('k') | KeyCode::Up => { KeyCode::Char('k') | KeyCode::Up => {
@ -391,6 +395,9 @@ impl App {
// Jump to previous day // Jump to previous day
self.jump_to_previous_day(); self.jump_to_previous_day();
} }
LogViewSelection::All => {
// No navigation at All level - already selecting everything
}
} }
} }
KeyCode::Char('e') => { KeyCode::Char('e') => {
@ -408,7 +415,8 @@ impl App {
KeyCode::Char('h') | KeyCode::Left => { KeyCode::Char('h') | KeyCode::Left => {
// Zoom out selection level // Zoom out selection level
self.log_view_selection_level = match (&self.log_view_selection_level, &self.log_view_grouping) { self.log_view_selection_level = match (&self.log_view_selection_level, &self.log_view_grouping) {
(LogViewSelection::Day, _) => LogViewSelection::Day, // Already at highest (LogViewSelection::All, _) => LogViewSelection::All, // Already at highest
(LogViewSelection::Day, _) => LogViewSelection::All,
(LogViewSelection::Project, _) => LogViewSelection::Day, (LogViewSelection::Project, _) => LogViewSelection::Day,
(LogViewSelection::Entry, LogViewGrouping::ByProject) => LogViewSelection::Project, (LogViewSelection::Entry, LogViewGrouping::ByProject) => LogViewSelection::Project,
(LogViewSelection::Entry, LogViewGrouping::ByDate) => LogViewSelection::Day, (LogViewSelection::Entry, LogViewGrouping::ByDate) => LogViewSelection::Day,
@ -421,6 +429,8 @@ impl App {
(LogViewSelection::Project, _) => LogViewSelection::Entry, (LogViewSelection::Project, _) => LogViewSelection::Entry,
(LogViewSelection::Day, LogViewGrouping::ByProject) => LogViewSelection::Project, (LogViewSelection::Day, LogViewGrouping::ByProject) => LogViewSelection::Project,
(LogViewSelection::Day, LogViewGrouping::ByDate) => LogViewSelection::Entry, (LogViewSelection::Day, LogViewGrouping::ByDate) => LogViewSelection::Entry,
(LogViewSelection::All, LogViewGrouping::ByProject) => LogViewSelection::Day,
(LogViewSelection::All, LogViewGrouping::ByDate) => LogViewSelection::Day,
}; };
} }
KeyCode::Char('c') => { KeyCode::Char('c') => {
@ -656,6 +666,10 @@ impl App {
// Copy the entire day // Copy the entire day
self.get_selected_day_text() self.get_selected_day_text()
} }
LogViewSelection::All => {
// Copy the entire view/period
self.log_view_content.join("\n")
}
}; };
// Copy to clipboard using the persistent clipboard instance // Copy to clipboard using the persistent clipboard instance

View file

@ -563,6 +563,11 @@ fn render_log_view(frame: &mut Frame, app: &App) {
} }
} }
} }
LogViewSelection::All => {
// Select everything
selected_line_start = 0;
selected_line_end = app.log_view_content.len().saturating_sub(1);
}
} }
// Third pass: render with highlighting // Third pass: render with highlighting