Skip to content

Cross file motion / Continuous mode: move on the next file when reaching - #371

Merged
umputun merged 3 commits into
umputun:masterfrom
noguespi:feat-cross-file-motion
Oct 5, 2026
Merged

umputun merged 3 commits into
umputun:masterfrom
noguespi:feat-cross-file-motion

Conversation

@noguespi

@noguespi noguespi commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

DISCLAIMER: This is just a proof of concept for my feature request, not an actual PR.

100% vibe coded using qwen 3.8 flash next (low quality model), barely reviewed the code, I don't know your codebase, I didn't even read a single contribute/readme and I'm not a go developer (but your diff tool is great !).

It would be useful to move on the next file when we press page down or down and we are already at the bottom of a file. Or move up when already at the top and pressing up/page up.

This poc implements it and it works.

@noguespi
noguespi requested a review from umputun as a code owner October 4, 2026 16:02
a boundary press while the next file was still loading stepped the tree again. A held `j` could pass files that were never shown, and `j` then `k` left the tree on one file and the pane on another. Such a press is ignored until the request completes or is canceled.

the cursor position queued for the next file was applied by the next accepted successful load. A compact toggle mid-crossing sent the cursor to the top of the current file and left the compact anchor unapplied, and a failed load kept the queued position armed. It carries its load's sequence and a superseding accepted load drops it. Reload clears the outstanding request, so a failed file-list reload cannot leave crossing blocked.

extracted cursor placement into `placeCursorAfterLoad` to satisfy gocyclo. Tests are folded into diffnav_test.go, with regression tests for reversal, compact supersession, failed loads and cancellation. Plugin skills pass `--cross-file-motion` only when the user asks, like `--start-at-change`.
…irectory

a mouse click can leave the tree cursor on a directory row. Cross-file motion stepped from that row, so `j` at the file edge skipped a file and `k` could move forward. In that case it steps from the displayed file.

Home/End get their own test with the cursor parked where each action sends it, so the no-crossing assertion can fail. The "config file false overrides env" subtest set no env var and asserted the default, so it is removed. `crossFileMotionAction` is a method. Codex usage.md and config.md match the Claude copies for both cross-file flags.
@umputun

umputun commented Oct 5, 2026

Copy link
Copy Markdown
Owner

the gap is real: j and PgDn stop at the end of a file, and nothing lets the same key carry on into the next one. The PoC was useful as a starting point, so I finished it on this branch instead of closing the PR.

I pushed two commits on top of yours:

  • a press at the file edge is ignored while the next file is still loading. Before, a held j stepped the tree again and could pass files that were never shown, and j then k left the tree on one file and the pane on another
  • the cursor position queued for the next file belongs to that file's load. A compact toggle in the middle of a crossing used to send the cursor to the top of the current file
  • crossing steps from the displayed file when a mouse click left the tree cursor on a directory row
  • tests moved into diffnav_test.go, and the plugin skills pass --cross-file-motion only when the user asks for it

for next time, pls read CONTRIBUTING.md before opening a PR and decide from it what the change needs. A first PR here needs an issue stating the problem you hit and my approval before any code is written. Ideas and brainstorming go to Discussions. A PR explains the problem and how the change solves it, and it is code you have read that passes make test and make lint. A PR opened as a demo for a feature request leaves the review and the cleanup to me.

@umputun
umputun merged commit d8de33a into umputun:master Oct 5, 2026
2 checks passed
umputun added a commit that referenced this pull request Oct 5, 2026
a compact toggle during an in-flight file switch leaves the tree and the pane on different files. The cross-file hunk jump queued by `]` is applied by the next accepted successful file load, whatever file it is for. A config file value overrides the matching env var, against the documented precedence.
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.

2 participants