Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: Remove false positive line trimming#170

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
BurntSushi wants to merge1 commit intorust-lang:master
base:master
Choose a base branch
Loading
fromBurntSushi:ag/cutting-unicode

Conversation

@BurntSushi
Copy link
Member

Previously, it was possible for a... to be inserted when no trimming
was actually done. For example:

  |1 |   version = "0.1.0"2 |   # Ensure that the spans from toml handle utf-8 correctly3 |   authors = [  |  ___________^4 | |     { name = "Z...ALGO", email = 1 }5 | | ]  | |_^ RUF200  |

After this fix, the... is no longer inserted:

  |1 |   version = "0.1.0"2 |   # Ensure that the spans from toml handle utf-8 correctly3 |   authors = [  |  ___________^4 | |     { name = "ZALGO", email = 1 }5 | | ]  | |_^ RUF200  |

This is another low confidence fix where I'm not sure that it's right.
But the implementation was previously seeming to conflate the line
length (in bytes) versus the actual rendered length. So instead of
trying to do some math to figure out whether an ellipsis should be
inserted, we just keep track of whether the code line we write was
truncated or not.

Previously, it was possible for a `...` to be inserted when no trimmingwas actually done. For example:```  |1 |   version = "0.1.0"2 |   # Ensure that the spans from toml handle utf-8 correctly3 |   authors = [  |  ___________^4 | |     { name = "Z...ALGO", email = 1 }5 | | ]  | |_^ RUF200  |```After this fix, the `...` is no longer inserted:```  |1 |   version = "0.1.0"2 |   # Ensure that the spans from toml handle utf-8 correctly3 |   authors = [  |  ___________^4 | |     { name = "ZALGO", email = 1 }5 | | ]  | |_^ RUF200  |```This is another low confidence fix where I'm not sure that it's right.But the implementation was previously seeming to conflate the linelength (in bytes) versus the actual rendered length. So instead oftrying to do some math to figure out whether an ellipsis should beinserted, we just keep track of whether the code line we write wastruncated or not.
@BurntSushi
Copy link
MemberAuthor

Hah, the ZALGO text doesn't seem to really render? The regression test in the PR should clarify things a bit.

BurntSushi added a commit to astral-sh/ruff that referenced this pull requestJan 8, 2025
This fix was sent upstream and the PR description includes more details:rust-lang/annotate-snippets-rs#170Without this fix, there was an errant snapshot diff that looked likethis:  |1 |   version = "0.1.0"2 |   # Ensure that the spans from toml handle utf-8 correctly3 |   authors = [  |  ___________^4 | |     { name = "Z...ALGO", email = 1 }5 | | ]  | |_^ RUF200  |That ellipsis should _not_ be inserted since the line is not actuallytruncated. The handling of line length (in bytes versus actual renderedlength) wasn't quite being handled correctly in all cases.With this fix, there's (correctly) no snapshot diff.
BurntSushi added a commit to astral-sh/ruff that referenced this pull requestJan 8, 2025
This fix was sent upstream and the PR description includes more details:rust-lang/annotate-snippets-rs#170Without this fix, there was an errant snapshot diff that looked likethis:  |1 |   version = "0.1.0"2 |   # Ensure that the spans from toml handle utf-8 correctly3 |   authors = [  |  ___________^4 | |     { name = "Z...ALGO", email = 1 }5 | | ]  | |_^ RUF200  |That ellipsis should _not_ be inserted since the line is not actuallytruncated. The handling of line length (in bytes versus actual renderedlength) wasn't quite being handled correctly in all cases.With this fix, there's (correctly) no snapshot diff.
BurntSushi added a commit to astral-sh/ruff that referenced this pull requestJan 8, 2025
This fix was sent upstream and the PR description includes more details:rust-lang/annotate-snippets-rs#170Without this fix, there was an errant snapshot diff that looked likethis:  |1 |   version = "0.1.0"2 |   # Ensure that the spans from toml handle utf-8 correctly3 |   authors = [  |  ___________^4 | |     { name = "Z...ALGO", email = 1 }5 | | ]  | |_^ RUF200  |That ellipsis should _not_ be inserted since the line is not actuallytruncated. The handling of line length (in bytes versus actual renderedlength) wasn't quite being handled correctly in all cases.With this fix, there's (correctly) no snapshot diff.
BurntSushi added a commit to astral-sh/ruff that referenced this pull requestJan 9, 2025
This fix was sent upstream and the PR description includes more details:rust-lang/annotate-snippets-rs#170Without this fix, there was an errant snapshot diff that looked likethis:  |1 |   version = "0.1.0"2 |   # Ensure that the spans from toml handle utf-8 correctly3 |   authors = [  |  ___________^4 | |     { name = "Z...ALGO", email = 1 }5 | | ]  | |_^ RUF200  |That ellipsis should _not_ be inserted since the line is not actuallytruncated. The handling of line length (in bytes versus actual renderedlength) wasn't quite being handled correctly in all cases.With this fix, there's (correctly) no snapshot diff.
BurntSushi added a commit to astral-sh/ruff that referenced this pull requestJan 10, 2025
This fix was sent upstream and the PR description includes more details:rust-lang/annotate-snippets-rs#170Without this fix, there was an errant snapshot diff that looked likethis:  |1 |   version = "0.1.0"2 |   # Ensure that the spans from toml handle utf-8 correctly3 |   authors = [  |  ___________^4 | |     { name = "Z...ALGO", email = 1 }5 | | ]  | |_^ RUF200  |That ellipsis should _not_ be inserted since the line is not actuallytruncated. The handling of line length (in bytes versus actual renderedlength) wasn't quite being handled correctly in all cases.With this fix, there's (correctly) no snapshot diff.
BurntSushi added a commit to astral-sh/ruff that referenced this pull requestJan 13, 2025
This fix was sent upstream and the PR description includes more details:rust-lang/annotate-snippets-rs#170Without this fix, there was an errant snapshot diff that looked likethis:  |1 |   version = "0.1.0"2 |   # Ensure that the spans from toml handle utf-8 correctly3 |   authors = [  |  ___________^4 | |     { name = "Z...ALGO", email = 1 }5 | | ]  | |_^ RUF200  |That ellipsis should _not_ be inserted since the line is not actuallytruncated. The handling of line length (in bytes versus actual renderedlength) wasn't quite being handled correctly in all cases.With this fix, there's (correctly) no snapshot diff.
BurntSushi added a commit to astral-sh/ruff that referenced this pull requestJan 14, 2025
This fix was sent upstream and the PR description includes more details:rust-lang/annotate-snippets-rs#170Without this fix, there was an errant snapshot diff that looked likethis:  |1 |   version = "0.1.0"2 |   # Ensure that the spans from toml handle utf-8 correctly3 |   authors = [  |  ___________^4 | |     { name = "Z...ALGO", email = 1 }5 | | ]  | |_^ RUF200  |That ellipsis should _not_ be inserted since the line is not actuallytruncated. The handling of line length (in bytes versus actual renderedlength) wasn't quite being handled correctly in all cases.With this fix, there's (correctly) no snapshot diff.
BurntSushi added a commit to astral-sh/ruff that referenced this pull requestJan 14, 2025
This fix was sent upstream and the PR description includes more details:rust-lang/annotate-snippets-rs#170Without this fix, there was an errant snapshot diff that looked likethis:  |1 |   version = "0.1.0"2 |   # Ensure that the spans from toml handle utf-8 correctly3 |   authors = [  |  ___________^4 | |     { name = "Z...ALGO", email = 1 }5 | | ]  | |_^ RUF200  |That ellipsis should _not_ be inserted since the line is not actuallytruncated. The handling of line length (in bytes versus actual renderedlength) wasn't quite being handled correctly in all cases.With this fix, there's (correctly) no snapshot diff.
BurntSushi added a commit to astral-sh/ruff that referenced this pull requestJan 15, 2025
This fix was sent upstream and the PR description includes more details:rust-lang/annotate-snippets-rs#170Without this fix, there was an errant snapshot diff that looked likethis:  |1 |   version = "0.1.0"2 |   # Ensure that the spans from toml handle utf-8 correctly3 |   authors = [  |  ___________^4 | |     { name = "Z...ALGO", email = 1 }5 | | ]  | |_^ RUF200  |That ellipsis should _not_ be inserted since the line is not actuallytruncated. The handling of line length (in bytes versus actual renderedlength) wasn't quite being handled correctly in all cases.With this fix, there's (correctly) no snapshot diff.
BurntSushi added a commit to astral-sh/ruff that referenced this pull requestJan 15, 2025
This fix was sent upstream and the PR description includes more details:rust-lang/annotate-snippets-rs#170Without this fix, there was an errant snapshot diff that looked likethis:  |1 |   version = "0.1.0"2 |   # Ensure that the spans from toml handle utf-8 correctly3 |   authors = [  |  ___________^4 | |     { name = "Z...ALGO", email = 1 }5 | | ]  | |_^ RUF200  |That ellipsis should _not_ be inserted since the line is not actuallytruncated. The handling of line length (in bytes versus actual renderedlength) wasn't quite being handled correctly in all cases.With this fix, there's (correctly) no snapshot diff.
@epage
Copy link
Contributor

The renderer was rewritten with 0.12. We should verify if this is still a problem.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@BurntSushi@epage

[8]ページ先頭

©2009-2025 Movatter.jp