Skip to content

Behave like herdr-reviewr - #10

Merged
rednafi merged 163 commits into
masterfrom
herdr-parity
Oct 26, 2026
Merged

rednafi merged 163 commits into
masterfrom
herdr-parity

Conversation

@rednafi

@rednafi rednafi commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Stacked on #9.

  • rexdiff now behaves like herdr-reviewr. Refresh runs git only after a file changes, turns follow herdr's rules, comments keep their lines, and the PR view refetches every minute.
  • Keys, prompts, and messages match herdr-reviewr: the quit prompt, the comment list, the commit picker, the find band, search modes with a preview, the file tree with four list positions, and double- and triple-click copy.
  • The Rex parts stay: Lua settings, the Rex action, agents from Rex, editors in a Rex pane, terminal colours, and self-update.

A bar in the colour of the line, green or red, marks an inserted or a
deleted line in place of + or -. The bar takes the same two cells, so
the columns, the clicks, and the wrap do not change. The setting
diff_signs = true gives the signs back. The review text for the agent
keeps + and -.

Fixes #3
The diff showed only three lines around each change, and the rest of
the file was not there. Now the diff has the whole file, and a long run
of unchanged lines folds into one row, "⋯ 13 unmodified lines", as in
herdr-reviewr. → or a click on the row shows the lines. On a line of
code, → still scrolls sideways. A fold with a comment on one of its
lines always shows, and ":" with a line in a fold shows the fold. A new
scope folds the lines again.

Fixes #2
…itor code

- A fold that shows keeps the selection and the hits of a find on their
  lines, and the cursor goes to the first line of the fold, also at the top.
- An unknown editor gets +line again. open and xdg-open are window openers.
- Split the editor command into templateCommand and envCommand, and make
  the table without init.
- Rename the fold option Show to Expanded, key the expanded folds by a
  struct, and convert the fold types with named fields.
- Simpler tests, with shared helpers for scripts and a fake rex.
…ead quoted editor paths

- Key an expanded fold by its old line number, which does not change while
  the agent edits the files.
- Read the program of an editor in quotes, so a path with spaces works.
- Tell in the README how to open an unknown editor in a window.
…hem after a commit

- An expanded fold is a range of old lines. An agent edit in the range
  keeps all its lines open.
- A new old content, for example after a commit or a new turn, closes the
  expanded folds of the file.
- editorCommand has window in place of terminal, and program uses
  CutPrefix.
- diffview folds each hunk, so the folds always match the hunks.
- Simpler comments.
…olds after a restart

- A fold that overlaps an expanded range shows. An undo of a change next
  to the range makes a larger fold, which shows as a whole.
- The state of a restart for an update keeps the expanded folds, so the
  cursor comes back to its line.
- The old content of a file is kept as a hash.
- Tell in the README that EDITOR comes from the login shell.
- Follow the Google Go style guide: one-line signatures and calls, no
  string literals split only for length, doc comments on the exported
  const groups, no names that hide functions or a named result.
- Modern Go: slices.Compare, slices.IndexFunc, slices.Compact, a min with
  three values, errors.Is with fs.ErrNotExist, strconv.Itoa.
- Comments in ASD-STE100: one idea in each sentence, present tense, test
  doc comments of one sentence, and no semicolons that join ideas.

No change in behavior.
- Files uses git ls-files --deduplicate. In a merge conflict, git lists a
  path once for each stage, so the Files tab showed it three times.
- renderChanges gets the comments once for all the folds of a file.
- Small simplifications and present-tense comments.
A sideways scroll renders the diff again, and each render highlighted
every line again with chroma. diff.Cache keeps the highlighted lines, and
the tui keeps one Cache for all renders. On a 5,000-line file, a scroll
key takes 8 ms in place of 20 ms with the folds closed, and 11 ms in
place of 180 ms in the Files tab.
On a deleted line, e opened the file at line 1. It now opens at the
first new line below the cursor, else the last new line above it.
A file with an unknown name gets its lexer from the content, and that
scan took 30 ms on each render of a 5,000-line file. Also simplify the
cache comments and the benchmark.
…diff

- internal/editor builds the editor command, so tui only runs it.
- internal/termtext has Plain and Quote, which diff exported before.
- vcs.PullRequest removes control characters from the text itself, so
  every caller gets safe text.
Comments use the present tense, one idea in each sentence, and lines of
80 columns or fewer. Each test failure message tells what it got and
what it wants. No code changes.
- editor.Template, editor.Program, and editor.ShellQuote replace
  FromTemplate, FromEditor, and Quote.
- The View reads the lexer from its Cache only.
- Fix a doc link to termtext.Quote.
herdr-reviewr writes the location, the snippet and the text, with no
note about stale code.
With no editor set, e shows "no editor" and opens nothing. rexdiff
checks the program and the file before it opens a pane, and uses the
messages of herdr-reviewr: "is gone", "editor not found", "editor
failed", "opened" and "edited".
A failed Files refresh shows "refresh failed" and keeps the old list.
The base and commit pickers show the git error and do not open. The
search shows a grep error in place of the results. A failed turn
snapshot goes to the log.
A file is binary if it has a NUL byte anywhere. Diff marks a file too
big if its two versions together have more than 2,000,000 bytes or
50,000 lines. ReadFile also checks the line limit. The notes say
"binary file · no line comments" and "file too large to show".
Use the notes and messages of herdr-reviewr: "no changes", "no
files", "empty file", "couldn't read this file", "no matches",
"comment added", "comment updated", "comment deleted" and
"nothing here renders". A status shows for 4 s.

The go-to-line prompt takes only digits and "$", a paste keeps only
a line number, and the line is clamped to the file. A deleted file
uses its old lines. m acts only on a markdown file.
A key bound to two actions is an error that names both, in the order
of the herdr-reviewr table. A key is one character or a named key
(left, right, up, down, pageup, pagedown), alone or after ctrl+ or
alt+. pgup and pgdown stay valid.
As in herdr-reviewr, the split layout needs 135 columns of code and a
Changes diff with lines on both sides and a change. The choice stays,
so a wider pane shows split again. On a narrow pane, | says "too
narrow for split".
Copy with pbcopy, wl-copy, xclip, or xsel, as herdr-reviewr does, and
show why a copy fails. A good copy of the comments clears them, as a
send does. The drag copy uses the same tool.
In the quit prompt, Q quits, q does nothing, s sends, y copies, and any
other key closes it. q is the only quit key, and home and end do not
move, as in herdr-reviewr.
c always makes a new comment, and c and d need the focus on the diff.
An edit with blank text keeps the comment. The comment list is
"Comments (N)" and takes e, d, s, y, l, and esc. An edit from the list
goes back to the list. Enter still jumps.
The picker lists the first-parent commits after the fork point of the
base, else the last 50, with herdr-reviewr's titles. It has no filter.
v anchors a range, and esc clears the anchor, then closes. The picker
opens on the current pick.
Past the last change, ] or [ arms a crossing to the next file with a
change, and the footer shows it. The same key again crosses. Another
key drops the arm. esc drops one layer per press: the selection, the
arm, then the list of all keys.
Final pass: bug fixes, black-box tests, stdlib cleanup, and docs
@rednafi
rednafi changed the base branch from scroll-cache to master October 26, 2026 17:54
@rednafi
rednafi marked this pull request as ready for review October 26, 2026 17:54
@rednafi
rednafi merged commit 8a03554 into master Oct 26, 2026
5 checks passed
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.

1 participant