navigation of views is now easier

This commit is contained in:
Hermes Agent
2026-08-16 20:36:22 +00:00
parent 93fb3fcdb1
commit 7c0f5a2e0a
4 changed files with 34 additions and 4 deletions

View File

@@ -74,6 +74,8 @@ Research URLs:
item editor, property editor, notes, category chooser, help, and status messages.
- [x] Marking and bulk completion; Trash view, soft discard, and recovery.
- [x] Responsive wide/compact rendering and mouse row/command/view interaction.
- [x] Vi-style `h`/`l` saved-view navigation with wraparound and legacy
`[`/`]` aliases.
- [x] Application Preferences persisted as typed TOML at
`~/.config/rogue-agenda/preferences.toml`: theme, command bar, rule/return/item
markers, autosave, confirmations, date/time display, and number separators;

View File

@@ -99,7 +99,7 @@ or build failure stops the gate.
| `F10` or `m` | Command menu |
| `r` | Edit prerequisites for the selected item |
| `/` | Search the current view |
| `[` / `]` | Previous / next saved view |
| `h` / `l` | Previous / next saved view (`[` / `]` are aliases) |
| `Ctrl-S` | Save/checkpoint |
| `?` or `F1` | Help |
| `q` | Quit |

View File

@@ -301,8 +301,8 @@ impl App {
self.search.clone(),
false,
),
KeyCode::Char(']') => self.switch_view(1)?,
KeyCode::Char('[') => self.switch_view(-1)?,
KeyCode::Char('l') | KeyCode::Char(']') => self.switch_view(1)?,
KeyCode::Char('h') | KeyCode::Char('[') => self.switch_view(-1)?,
KeyCode::Delete => self.discard_or_restore()?,
KeyCode::Esc if !self.search.is_empty() => {
self.search.clear();

View File

@@ -633,7 +633,7 @@ fn draw_overlay(frame: &mut Frame<'_>, app: &mut App) {
Line::from("↑↓/jk move Insert/n new Enter/F2 edit F3/c categories"),
Line::from("F4/d done F5 note F6/p properties F7/Space mark"),
Line::from("F8/v views F9 categories F10/m menu / search"),
Line::from("[ ] views r prerequisites Delete trash/recover"),
Line::from("h/l views ([/]) r prerequisites Delete trash/recover"),
Line::from("Ctrl-S save q quit"),
Line::from(""),
Line::from("Mouse: click items, view tabs, or function-key tiles."),
@@ -1259,6 +1259,34 @@ mod tests {
assert!(screen.contains("When"));
}
#[test]
fn main_screen_h_and_l_cycle_views_with_wraparound() {
let directory = tempdir().unwrap();
let path = directory.path().join("view-navigation.agnd");
let db = Database::open(&path).unwrap();
let mut app = App::new_with_preferences(
db,
path,
AppPreferences::default(),
directory.path().join("preferences.toml"),
)
.unwrap();
assert!(app.views.len() > 1);
app.handle_key(KeyEvent::new(KeyCode::Char('l'), KeyModifiers::NONE))
.unwrap();
assert_eq!(app.view_index, 1);
app.handle_key(KeyEvent::new(KeyCode::Char('h'), KeyModifiers::NONE))
.unwrap();
assert_eq!(app.view_index, 0);
app.handle_key(KeyEvent::new(KeyCode::Char('h'), KeyModifiers::NONE))
.unwrap();
assert_eq!(app.view_index, app.views.len() - 1);
app.handle_key(KeyEvent::new(KeyCode::Char(']'), KeyModifiers::NONE))
.unwrap();
assert_eq!(app.view_index, 0);
}
#[test]
fn note_editor_renders_and_saves_entered_line_breaks() {
let d = tempdir().unwrap();