feat: display review comments inline in the diff view - #21
Open
KEY60228 wants to merge 2 commits into
Open
Conversation
Render each comment's full text as a bordered virtual-line block below its anchor line (the comment's end_line on the matching side), in addition to the existing eol comment sign. Multiple comments on the same line are stacked in order, and long lines are wrapped by display width so multibyte (e.g. Japanese) text stays readable. - Add `inline_comments` config option (default: true) to toggle the feature - Add ReviewThemInlineComment / ReviewThemInlineCommentBorder highlight groups linked to Comment / NonText for theme friendliness - Add a headless functional test (tests/inline_comments_spec.lua) - Document the feature in README and :help reviewthem Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Inline comment blocks are virtual lines on one side of the diff only, so the other pane drifted upward on screen — 'scrollbind' syncs buffer lines, not screen rows. With a 5-line block and 22-line panes the old side showed buffer lines 1-22 while the new side showed 1-17. - Mirror each block's height as blank filler lines in the opposite pane, so both buffers occupy the same screen rows. Decoration now runs for both panes at once, since fillers need the other side's block heights. - Re-wrap comment text on WinResized/VimResized when the wrap width actually changes; the width used to be frozen at first render. - Keep bytes that are not valid UTF-8 while wrapping. The old character pattern could not start a character on 0x00 or 0xF5-0xFF and dropped them. - Expand tabs before measuring width. nvim_strwidth reports 1 for a tab while it draws as 'tabstop' columns, which split a line at every tab. - Measure with nvim_strwidth instead of a strdisplaywidth call per character. - Drop the |comment_sign| doc link: no such help tag exists. - Tests: assert against the wrap width the renderer was given instead of a constant that passed trivially, verify both panes end up with equal virtual line height per row, cover tabs and invalid UTF-8, and make the ordering check fail instead of erroring when a pattern does not match. - Add a make test target so the checks are runnable. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QvF1sbz4NudDsjqzQDivGS
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
virt_lines, as a bordered block (┌─ 💬 L10-12 ─header with the line range,│-prefixed text lines,└─footer)end_lineon the matching side; multiple comments on the same line are stacked instart_lineorderinline_commentsconfig option (default:true); when disabled, behavior is exactly as before (only the eol💬sign)ReviewThemInlineComment(links toComment) andReviewThemInlineCommentBorder(links toNonText)tests/inline_comments_spec.lua) covering multi-line comments, multibyte wrapping, stacking, and the config toggle:help reviewthemTest plan
nvim --headless -c "set rtp+=." -c "lua require('reviewthem').setup()" -c "q"loads cleanlynvim --headless -l tests/inline_comments_spec.luapasses (13 checks)inline_comments = falseand confirm only the💬eol sign is shown🤖 Generated with Claude Code