[feature] diff: soft word wrap #153
Merged
Merged
Conversation
This was referenced May 22, 2026
Closed
The merge of main into feat/diff-word-wrap was resolved by naively accepting both sides of every conflict, which produced code that did not compile and would have double-rendered every diff row. app.rs: rewrite the Right/l key handler to mirror Left/h. The previous resolution left a duplicate nested `if`, an unclosed brace, and a dead sidebar branch. Also restore main's clamp_h_scroll / clamp_sidebar_h_scroll calls. diff_view.rs: fix four render sites that called both push_wrapped_line and pad_line_bg on the same `spans`, which use-after-moved the vec and would have pushed each row twice. Each site now branches on settings.wrap and takes exactly one path. The side-by-side new panel also now subtracts the correct number of borders (1 when the old panel is present, 2 otherwise) when computing wrap width.
Add a --wrap flag and in-app w toggle for the diff viewer. Soft-wrap long diff lines with indentation preserved on continuation rows, keep side-by-side panels aligned, and disable horizontal scrolling while wrapping is active. Document the feature and cover CLI parsing for the new flag.
- Delete 7 dead_code wrap functions (span_width, spans_width, leading_indent_width, flatten_spans, styled_chars_to_spans, next_wrap_break, wrap_content_spans) and their associated tests. The active wrap implementation lives in wrapped_diff_lines. - Add missing hook field to DiffOptions test initializers in git.rs to fix compilation after upstream merge.
2aa04a0 to
e672f97
Compare
Resolved conflicts: - src/config/cli.rs: removed HookFormat/hook arg, kept wrap arg - src/main.rs: removed hook field, kept wrap field - src/command/diff/mod.rs: removed hook field, kept wrap field - src/command/diff/render/diff_view.rs: accepted overlay-slot rendering from main, preserved word-wrap helper functions and wrap rendering - src/command/diff/git.rs: removed hook field from test DiffOptions structs
e672f97 to
392922f
Compare
Owner
|
Hey, love this! I don't particularly like the ability to toggle word-wrap and also would like to reserve the we can just allow this via the CLI flag and also an option in |
- Reassign 'w' keybinding from word-wrap toggle to watch mode toggle - Start/stop file watcher dynamically on watch mode toggle - Add 'wrap' option to lumen.config.json - Keep --wrap CLI flag for setting word-wrap at startup
- Return WatchHandle from setup_watcher so dropping it stops the watcher thread, preventing leaks on repeated watch toggle cycles - Guard w key toggle to no-op in PR mode (watch not supported for PRs) - Set state.watching to false when watcher fails to start
…tch changes - Set state.watching = false when PR mode is active (prevents fake 'watching for changes...' indicator in empty-state UI) - README: change 'w' keybinding from 'Toggle word wrap' to 'Toggle watch mode' - README: remove duplicate 'w' keybinding entry - README: update --wrap description to mention lumen.config.json - README: add 'wrap' option to example config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds soft word wrap to the interactive diff viewer. This was achieved with the assistance of a coding agent: Codex. So if you have time, please do a review (if you still can't or won't I totally understand).
lumen diff --wrapto start the diff UI with wrapping enabledwas an in-app toggle for word wrapTesting
cargo checkcargo test wrap_testscargo test test_diff_wrap_parsescargo buildAll test pass.
Issues
Closes #149
Closes #119
Demo
screenrecording-2026-05-22_11-20-41.mp4