Skip to content

Review fixes and a codebase pass for style, modern Go, and comments - #8

Closed
rednafi wants to merge 7 commits into
diff-foldsfrom
review-pass
Closed

rednafi wants to merge 7 commits into
diff-foldsfrom
review-pass

Conversation

@rednafi

@rednafi rednafi commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Stacked on #7. The review rounds and the codebase pass after the three fixes.

Review fixes (from 2× /p-simplify and 3× /p-review)

  • Folds:
    • A fold that shows keeps the selection and the hits of a find on their lines. The cursor goes to the first line of the fold, also for the fold at the top.
    • An expanded fold is a range of old lines. An agent edit in the range, or next to it, keeps the lines open. A new old content (a commit, a new turn) closes the folds of the file.
    • A restart for an update keeps the expanded folds, so the cursor comes back to its line.
    • Show is renamed Expanded.
  • Editor:
    • An unknown editor gets +line again, as on master.
    • open and xdg-open are window openers.
    • A quoted editor path with spaces works.
    • templateCommand and envCommand replace one function with two modes.
  • Files lists a path in a merge conflict once (git ls-files --deduplicate, git 2.31, which rexdiff already needs).
  • README: how to open an unknown editor in a window, where to set EDITOR with zsh, and the git version.

Codebase pass

  • Google Go style guide: one-line signatures and calls, no string literals split only for length, doc comments on exported const groups, no names that hide functions.
  • Modern Go 1.27: slices.Compare, slices.IndexFunc, slices.Compact, min with three values, errors.Is(err, fs.ErrNotExist).
  • Comments in ASD-STE100. No change in behavior.

Tests added

TestExpandKeepsPlaces, TestFoldStaysOpen (edit above, edit inside, undo next to, commit), TestFoldsSurviveRestart, TestFilesInConflict, more cases in TestEditorCommands. I checked that each new test fails without its fix.

Checks

go test -race ./..., go vet, golangci-lint (0 issues), staticcheck with all checks, go fix and modernize (no changes). End-to-end in Rex with the real toggle: folds, →, :20, and micro at (20,1).

…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.
@rednafi

rednafi commented Oct 26, 2026

Copy link
Copy Markdown
Owner Author

Merged into master through #10.

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