Fix hunk position counting to match GitHub's convention#71
Open
Fix hunk position counting to match GitHub's convention#71
Conversation
crs--get-comment-context and crs--find-position-in-diff were not counting subsequent @@ hunk headers as positions, while crs--insert-comments-into-buffer and crs--render-diff (and GitHub's own position convention) do count them. This caused local comments placed in the 2nd+ hunk of a file to have a position offset, so they were never matched during re-rendering and appeared invisible. https://claude.ai/code/session_01EmShngn7vgu9UCag1xDKd4
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
Fix the hunk position counting logic in two locations to properly handle subsequent hunk headers according to GitHub's position convention. Previously, only the first hunk was being counted, which caused incorrect position tracking for diffs with multiple hunks.
Changes
current-positioninstead of only initializing it on the first hunkcountvariable for subsequent hunksfirst-hunk-countedvariable to properly distinguish between the first and subsequent hunks in the second code pathTest Plan
https://claude.ai/code/session_01EmShngn7vgu9UCag1xDKd4