Conversation
cppcheck reports the column as a byte offset into the UTF-8 line, so every non-ASCII character before the error moved the highlight to the right (and past the end of the line for errors near its end). Sublime counts characters. Convert the column in `reposition_match` using the source line, in a small abstract base class shared by both linters. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WtRdpWmSGFACg8HR3Vpk3d
Member
|
Same as tslint, regression test should go through E.g. |
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.
Fixes #25.
cppcheck reports the column (
{column}) as a byte offset into the UTF-8 line, so every non-ASCII character before the error on the same line moved the highlight to the right, past the end of the line for errors near its end. Sublime counts characters.reposition_matchnow converts the byte offset to a character offset using the source line (vv.select_line(line)), like the fix in SublimeLinter-xmllint. Both linters (cppcheckandcppcheck++) get it from a small abstract base class. ASCII lines are unchanged.Checked with cppcheck 2.21.0 in Sublime Text 4215 (this branch loaded as
SublimeLinter-cppcheck), on the file from the issue: with anewith acute accent and an emoji before them, the array error is now on the[(start 18, it was 22) and the unread-variable error on the=(start 23, it was 27, i.e. on the line break).Tests:
tests/test_columns.pyuses the real output of cppcheck for that file (source and output are in the test), for both linter classes, plus the converter on its own (multi-byte characters, an offset inside a character, past the end); 4 tests pass in Sublime Text 4215, flake8 with the repo config is clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01WtRdpWmSGFACg8HR3Vpk3d