Stepping through a review with ] can pass content that never reached the screen

已关闭
#405 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
38/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
go

调研方向

Start by reading app/ui/model.go around pendingHunkJump and pendingAnnotJump, then trace how ] and [ navigate hunks and annotations. The issue lays out alternative interaction designs but leaves the desired approach undecided, so first determine how those actions and config are structured. Done means one key can step through every hunk and annotation across files, with boundary behavior and documentation in README, site/docs.html, and the plugin references/usage.md.

由索引模型根据 Issue 内容生成。

描述

Context

I lean heavily on ] to step through a review, with this in ~/.config/revdiff/config:

cross-file-hunks = true

The problem is that ] can move past content that never reached the screen:

  • A hunk taller than the viewport lands with its first line near the top. The next ] goes to the following hunk, so the rest of the tall one is never shown.
  • Annotations outside a hunk get skipped: file-level ones, ones on context lines, and ones above the first hunk of a file ] crosses into.

So when I reach the last hunk, I can't tell whether I've seen everything. Today I check with a second pass on } or by opening @.

Options

Is this worth solving, and if so, how would you approach it? Here are the shapes I can see, in case they help.

A. Separate next_step / prev_step actions

A new pair of actions that steps through hunk starts and annotations, in file order, across files. ], [, }, { stay as they are.

The default keys would be s / S, both unbound, following the n / N pattern for forward and back. Anyone who wants to step with ] rebinds it in ~/.config/revdiff/keybindings:

map ] next_step
map [ prev_step

Pros: existing keys keep their meaning; no new option.
Cons: two more actions that overlap ] and }; a third file-crossing landing intent next to pendingHunkJump and pendingAnnotJump.

B. Configurable stops for ] / [

Turn cross-file-hunks into a list of what ] / [ do, the same way include / exclude take a list. Working name step, since the key is no longer stepping through hunks alone:

step = cross-file,annotations
Value ] / [ also
cross-file crosses file boundaries (today's cross-file-hunks = true)
annotations stops at annotations outside hunks, including file-level ones

cross-file-hunks = true would keep working as step = cross-file.

Pros: no new keys; one setting for anyone who already steps with ].
Cons: ] means different things depending on config; a bool option migrates to a list.

Tall hunks

The tall-hunk case is a separate but related concern, and neither shape above covers it. It reads more like a viewport setting next to wrap than a stop type: working name show-more, where ] on a hunk taller than the viewport scrolls through the rest of it before moving to the next one.

Acceptance criteria

  • Existing behavior is unchanged by default; any change to how ], [, }, { behave is opt-in.
  • One key steps a review through every hunk and every annotation, crossing files.
  • Past the last step (or before the first), the key does nothing, as ] / [ do today at the last / first hunk.
  • README, site/docs.html, and the plugin references/usage.md copies cover whichever shape lands.
主要语言
Go
星标
943
派生
101
平均合并
1 天 15 小时
30 天内合并 PR
37

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

umputun/revdiff 的其他 Issue

查看 umputun/revdiff 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。