feat(diff): add unified/side-by-side diff view with XDG preferences - #13
Merged
Conversation
…lit, preferences, background)
…ences and black background - Add DiffFormat type with unified/split modes, toggle via toggle-diff-format event - Implement side-by-side view builder (buildViewDiffSplit) with del/add pairing algorithm - Enable commenting on deleted (old) lines in both unified and split views - Add Comment.Side field for old vs new line disambiguation - Persist diff format preference to localStorage across sessions - Change diff area background from var(--panel) to #000000 - Add side-by-side CSS layout with grid-based left/right columns - Update JS click handler to support old-line selection via data-old-line attribute
Replace localStorage with server-side preference storage using XDG config directory. Sidebar width and diff view format are now persisted across sessions and survive port changes. Changes: - Add xdg library for proper config directory selection (respects XDG_CONFIG_HOME) - Create preferences.json at ~/.config/meatcheck/preferences.json - Persist diff format (unified/split) and sidebar width on change - Remove localStorage entirely (sidebar restore, diff format restore, diff format save) - Add save-sidebar-width event handler to capture resize on mouseup - Set initial sidebar width via inline style (server-rendered) Layout improvements: - Fix grid alignment: change from max-content to 1fr with pre-wrap text wrapping - Add .diff-inner wrapper for consistent line width across all diff lines - Constrain split view horizontally with overflow-x: hidden - Toggle button moved to left side of header button group (first button)
jfyne
marked this pull request as ready for review
March 9, 2026 12:17
Apply `go fmt ./...` and `go fix ./...` to align struct field declarations and modernize for-loop syntax (range over maxLen).
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.
What's changed
Adds switchable unified/side-by-side diff view with
DiffFormattype andbuildViewDiffSplitpairing algorithm, enables commenting on deleted (old) lines viaComment.Sidefield, changes diff background to black, and replaces localStorage with server-side XDG preference storage for diff format and sidebar width.Requirements
Functional Requirements (EARS notation):
Acceptance Criteria:
Suggested review order
template.htmlstyles.csspre-wrapwrapping, diff-inner wrapper, intensified add/del colorsapp.gotoggle-diff-format,save-sidebar-width, updatedselect-line/add-comment/cancel-commentfor old-line supportview.gobuildViewDiffSplitpairing algorithm, side-awareprojectLineComments,updateDiffViewformat dispatchmodel.goDiffFormat,ViewDiffSide/ViewDiffRow/ViewDiffSplitHunk,Comment.Side,SelectionSide,SidebarWidthpreferences.gopreferences.jsonfor diff format and sidebar widthgo.modgithub.com/adrg/xdgdependencydiff_format_test.goDiffFormatconstants anddiffOldLineExistsside_comment_test.goprojectLineCommentsandComment.SideJSON marshalingview_diff_test.gobuildViewDiffold-line selection and commentingview_diff_split_test.gobuildViewDiffSplitpairing — context lines, del/add blocks, selection, comments, hunk headersdiff_format_view_test.goupdateDiffViewdispatch, toggle selection clearing, template render testscomment_test.goprojectLineCommentsdiff-view-options.md2026-03-09-diff-view-options.md