Repository navigation
Fix gutter width for following context lines - #417
Open
RanaPriyansh wants to merge 1 commit into
Open
RanaPriyansh wants to merge 1 commit into
RanaPriyansh wants to merge 1 commit into
Conversation
RanaPriyansh
force-pushed
the
repro/context-gutter-352
branch
from
September 24, 2026 09:44
bab9199 to
1845ca8
Compare
Collaborator
|
Can you show the fix that this change provides with before and after code blocks of the rendered diagnostic output |
Author
|
Thanks. Here is the rendered output for the 9→10 boundary. The source gutter separators do not align before the change. The fix adds the space required by the two-digit context line. Before: After: The 99→100 case shows the same correction. I also checked a multiline label ending on line 9. The label shape stays the same, and the outer gutters align. Both outputs use the same fixture and Codex used. |
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.
Problem
Following context can cross a line-number digit boundary. The renderer then places source gutter separators in different columns.
Change
Update the gutter width when an actual following context line is inserted. Add regression coverage for single-line, multiline, 9-to-10, and 99-to-100 boundaries.
Add controls for zero context, same-width context, and requested context beyond EOF.
Verification
cargo test -p codespan-reporting --test term context_digit_boundary -- --nocapturecargo test -p codespan-reporting --no-default-featurescargo test -p codespan-reporting --no-default-features --features stdcargo test -p codespan-reportingcargo test --workspacecargo fmt --all -- --checkcargo clippy --allAll listed checks pass on Rust 1.95.0 in the captured local receipts.
Limitations
Validated locally on macOS with Rust 1.95.0. The repository CI matrix has not run on this candidate.
This change makes no performance claim and does not change public APIs.
AI assistance was used to prepare this change and its tests.
Fixes #352.