Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unified diff hunk header highlight to allow for single-number case #4228

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sushicw
Copy link

@sushicw sushicw commented Mar 19, 2025

Resolves #4227

Changes

Update the regex for matching a unified hunk header to allow for single numbers as well as comma-paired numbers.

From https://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html, emphasis mine:

If a hunk contains just one line, only its start line number appears. Otherwise its line numbers look like ‘start,count’. An empty hunk is considered to start at the line that follows the hunk.

If a hunk and its context contain two or more lines, its line numbers look like ‘start,count’. Otherwise only its end line number appears. An empty hunk is considered to end at the line that precedes the hunk.

Checklist

  • Added markup tests, or they don't apply here because...
  • Updated the changelog at CHANGES.md

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.

(diff) Won't highlight hunk headers with a single number instead of a number pair
2 participants