You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that when using an emoji in the source, depending on the range I specify to associate a label to it, I get a label that make sense or not.
Code to reproduce:
use ariadne::{Label,Report,ReportKind,Source};fnmain(){for i in1..=4{println!("Using range {:?} for a 4-bytes emoji",0..i);letmut report = Report::build(ReportKind::Error,(),0);
report = report.with_label(Label::new(0..i).with_message("That is very haha 😂"));
report.finish().print(Source::from("😂")).unwrap();}}
The output:
Using range 0..1 for a 4-bytes emoji
Error:
╭─[<unknown>:1:1]
│
1 │ 😂
· ┬
· ╰── That is very haha 😂
───╯
Using range 0..2 for a 4-bytes emoji
Error:
╭─[<unknown>:1:1]
│
1 │ 😂
· ─┬
· ╰── That is very haha 😂
───╯
Using range 0..3 for a 4-bytes emoji
Error:
╭─[<unknown>:1:1]
│
·
───╯
Using range 0..4 for a 4-bytes emoji
Error:
╭─[<unknown>:1:1]
│
1 │ ╭─▶ 😂
───╯
I think the versions with the ranges 0..1, 0..2 and 0..3 don't make sense, but I would expect the last range (0..4) to display the label correctly.
The text was updated successfully, but these errors were encountered:
Ariadne currently uses character indices, not byte indices. I consider this to be a mistake that I want to fix eventually. I'm going to close this in favour of #57, but I'm happy to reopen it if you believe there's more going on here.
I noticed that when using an emoji in the source, depending on the range I specify to associate a label to it, I get a label that make sense or not.
Code to reproduce:
The output:
I think the versions with the ranges
0..1
,0..2
and0..3
don't make sense, but I would expect the last range (0..4
) to display the label correctly.The text was updated successfully, but these errors were encountered: