Skip to content

fix(inline): coalesce subword splits inside long hex literals#160

Merged
dlyongemallo merged 1 commit intomainfrom
improve_hex_diffs
May 7, 2026
Merged

fix(inline): coalesce subword splits inside long hex literals#160
dlyongemallo merged 1 commit intomainfrom
improve_hex_diffs

Conversation

@dlyongemallo
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings May 6, 2026 19:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves intraline diff rendering for long hex-like literals (notably git commit hashes) by preventing subword tokenization from fragmenting them into many small tokens, which can produce misleading “partial matches” and noisy highlights when comparing unrelated hashes.

Changes:

  • Added a hex-run predicate (is_hex_run) plus constants to detect hash-like single-case hex sequences.
  • Added a coalesce_hex_runs() post-pass in tokenize() to merge subword-split hex runs back into a single token.
  • Expanded functional tests to cover the tokenization rules and verify hash-only edits render as a single whole-token replacement (including overleaf inline deletions).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lua/diffview/scene/inline_diff.lua Adds hex-run detection and a post-tokenization coalescing pass to keep long hex literals atomic for intraline diffing.
lua/diffview/tests/functional/inline_diff_spec.lua Adds functional tests for tokenize()/is_hex_run() and regression coverage for hash-only JSON edits rendering cleanly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lua/diffview/scene/inline_diff.lua Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread lua/diffview/scene/inline_diff.lua Outdated
Comment thread lua/diffview/tests/functional/inline_diff_spec.lua Outdated
@dlyongemallo dlyongemallo merged commit f67cae5 into main May 7, 2026
7 checks passed
@dlyongemallo dlyongemallo deleted the improve_hex_diffs branch May 7, 2026 10:33
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.

2 participants