Skip to content

feat(ui): support configurable tree pane position - #295

Draft
winzamark123 wants to merge 6 commits into
umputun:masterfrom
winzamark123:feat/tree-position
Draft

feat(ui): support configurable tree pane position#295
winzamark123 wants to merge 6 commits into
umputun:masterfrom
winzamark123:feat/tree-position

Conversation

@winzamark123

@winzamark123 winzamark123 commented Jul 29, 2026

Copy link
Copy Markdown

What is the problem?

The file tree and Markdown TOC are fixed to the left side. Users whose navigation panes normally live on the right cannot configure revdiff to match that layout.

How does this solve it?

This adds --tree-position=left|right, with left remaining the default. The option is also available through REVDIFF_TREE_POSITION and the config file.

Pane navigation becomes directional:

  • h focuses the left pane
  • l focuses the right pane
  • focus_tree and focus_diff remain available for semantic custom bindings

The configured position also applies to the Markdown TOC and mouse routing.

Draft status

This is a work in progress and is not ready for review yet! I'm pretty new to Go as a language so let me know if there are any changes that doesn't follow best codebase pattern. I'd rather this be clean so I'm always open to comments.

Completed:

  • CLI, environment, and config support
  • Directional h/l focus
  • File tree and Markdown TOC positioning
  • Mouse hit testing
  • Documentation and tests

Still in progress:

  • Move the diff scrollbar to the correct outer edge in the right-tree layout
  • Verify horizontal-scroll indicators, center seam, and background fill
  • Add visual-geometry regression tests
  • Clean up the commit history before marking ready

Closes #279

- update default keymap generation to swap h/l keys when tree is on the right
- add DefaultForTreePosition and LoadOrDefaultForTreePosition helpers
- pass tree position config through to keymap loaders
- update UI model and navigation tests to verify correct pane switching for both tree positions
- add TreePosition type and constants (TreePositionLeft, TreePositionRight)
- replace boolean treeOnRight usage in keymap and UI with the new typed enum
- update option parsing to resolve string flags to the new TreePosition type
- simplify Load/Default signatures in keymap package to use TreePosition
- update all tests and callers to reflect the improved type safety
- remove `tree-position` option from configuration and CLI
- simplify `keymap` API to default to left-side pane navigation
- update documentation to remove references to tree-position settings
- refactor `ModelConfig` to remove unused tree position field

BREAKING CHANGE: The `tree-position` configuration option and CLI flag have been removed; the file tree and markdown TOC will now always be displayed on the left.
- add `focus_left` and `focus_right` actions to `keymap`
- implement `resolveDirectionalFocus` to map spatial focus to semantic panes based on `treePosition`
- remove `TreePosition` dependency from `keymap` package to simplify configuration and decoupling
- update default keybindings to use `focus_left`/`focus_right` instead of fixed `h`/`l` logic
- update documentation, examples, and tests to reflect the new focus logic
- refactor `resolveDirectionalFocus` to use a dynamic mapping of focus actions
- consolidate tree pane X-range calculation into a helper method
- unify `TestModel_FocusSwitching` using a table-driven approach
- simplify tree positioning tests by explicitly asserting horizontal order
Repository owner deleted a comment from rickgonzalez Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Supporting configurable tree pane position

1 participant