Skip to content

Add word wrap toggle for diff pane - #8

Merged
umputun merged 4 commits into
masterfrom
word-wrap
Apr 3, 2026
Merged

umputun merged 4 commits into
masterfrom
word-wrap

Conversation

@umputun

@umputun umputun commented Apr 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • w key toggles word wrap in the diff pane — long lines wrap at the pane boundary with continuation markers instead of requiring horizontal scroll
  • --wrap CLI flag and config file option to start with wrap enabled
  • mode icon in status line when wrap is active (alongside collapsed and filter)
  • Horizontal scroll (/) disabled when wrap is active, scrollX reset to 0
  • Cursor/viewport math updated to account for multi-row wrapped lines
  • Wrapping works in both expanded and collapsed diff modes
  • Help overlay updated with w keybinding

Copilot AI review requested due to automatic review settings April 3, 2026 00:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a word-wrap mode to the diff pane so long lines wrap at the viewport boundary (with continuation markers) instead of requiring horizontal scrolling, controllable via w and a new --wrap option.

Changes:

  • Introduces wrapMode (configurable via CLI/env/config) and a w key toggle that resets horizontal scroll and re-syncs the viewport.
  • Implements wrapped diff rendering (expanded + collapsed modes) with continuation markers and disables horizontal scroll while wrapping.
  • Updates cursor/viewport math for wrapped visual rows and extends tests + documentation accordingly.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ui/model.go Adds wrapMode, config wiring, w toggle, horizontal scroll handler routing, status icon, and help text update.
ui/model_test.go Adds extensive coverage for wrap config, icons, rendering, wrapping math, toggle behavior, scroll blocking, and help text.
ui/diffview.go Implements core wrapping logic (wrapContent, wrapped rendering, line counting) and disables horizontal scroll during wrap.
ui/collapsed.go Applies wrapping behavior to collapsed-mode add/modify lines and delete-only placeholders; shares placeholder text logic for math sync.
ui/collapsed_test.go Adds collapsed-mode wrap rendering tests (markers, gutters, cursor placement, placeholder behavior).
ui/annotate.go Updates cursorViewportY to account for wrapped visual rows and wrapped delete-only placeholders.
cmd/revdiff/main.go Adds --wrap flag/env/config integration and wires it into ui.ModelConfig.
cmd/revdiff/main_test.go Adds argument parsing coverage for --wrap via flag/env/config.
README.md Documents wrap mode and the --wrap flag and keybinding.
docs/plans/completed/20260402-word-wrap.md Marks implementation plan tasks as completed.
CLAUDE.md Documents the wrap-mode rendering flow and cursor math adjustments.
.claude-plugin/skills/revdiff/references/usage.md Adds w keybinding to usage reference.
.claude-plugin/skills/revdiff/references/config.md Adds --wrap/REVDIFF_WRAP to config reference.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@umputun
umputun merged commit 87ad1ec into master Apr 3, 2026
6 checks passed
@umputun
umputun deleted the word-wrap branch April 6, 2026 20:50
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