Skip to content

feat: Add directory history navigation (Alt+Left/Right) #19

@efimsky

Description

@efimsky

Summary

The codebase already maintains a _navigation_history breadcrumb cache (50-entry FIFO) in panel.py, but there's no key binding to navigate back/forward through previously visited directories.

Motivation

This is a low-effort, high-value addition. The infrastructure exists — we just need to expose it via keybindings. Users navigating deep directory trees frequently need to "go back" to where they were, without manually retracing steps through ...

Midnight Commander supports this pattern, and modern file managers (Nautilus, Dolphin, Finder) all have back/forward navigation.

Proposed Key Bindings

Key Action
Alt+Left Go back to previous directory
Alt+Right Go forward (after going back)

Implementation Notes

  • panel._navigation_history already stores parent→child breadcrumbs (dict, 50-entry limit)
  • Need to add a proper back/forward stack (separate from breadcrumb cache)
  • Back stack: push current dir before navigating, pop on Alt+Left
  • Forward stack: push current dir when going back, pop on Alt+Right; clear on manual navigation
  • Consider showing history in a dropdown (future enhancement)

Acceptance Criteria

  • Alt+Left navigates to the previously visited directory
  • Alt+Right navigates forward after going back
  • Forward stack clears on manual directory change (Enter, command line cd)
  • Works independently per panel
  • Navigation history persists across panel switches
  • Tests cover back, forward, stack clearing, and edge cases (empty stack, single entry)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions