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 display of annotation for double width characters #46

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

Merged
zbraniecki merged 4 commits into rust-lang:master from magurotuna:check-display-width
Sep 4, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add test to ensure it works when double-width and signle-width are mixed
  • Loading branch information
magurotuna committed Sep 4, 2021
commit fbdab5c79adbcd860512466b79c8e05042d251f2
28 changes: 28 additions & 0 deletions tests/formatter.rs
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -645,3 +645,31 @@ fn test_point_to_double_width_characters_multiple() {

assert_eq!(DisplayList::from(snippets).to_string(), expected);
}

#[test]
fn test_point_to_double_width_characters_mixed() {
let snippets = Snippet {
slices: vec![snippet::Slice {
source: "こんにちは、新しいWorld!",
line_start: 1,
origin: Some("<current file>"),
annotations: vec![snippet::SourceAnnotation {
range: (6, 14),
label: "New world",
annotation_type: snippet::AnnotationType::Error,
}],
fold: false,
}],
title: None,
footer: vec![],
opt: Default::default(),
};

let expected = r#" --> <current file>:1:7
|
1 | こんにちは、新しいWorld!
| ^^^^^^^^^^^ New world
|"#;
Comment on lines +668 to +672
Copy link
Contributor Author

@magurotuna magurotuna Sep 4, 2021

Choose a reason for hiding this comment

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


assert_eq!(DisplayList::from(snippets).to_string(), expected);
}

AltStyle によって変換されたページ (->オリジナル) /