mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
fix: correct calculation for fields in WideChar for line-specific positions
This commit is contained in:
parent
6557151dca
commit
9a3167e65e
1 changed files with 4 additions and 1 deletions
|
@ -363,7 +363,10 @@ fn analyze_source_file_generic(
|
||||||
let c = src[i..].chars().next().unwrap();
|
let c = src[i..].chars().next().unwrap();
|
||||||
char_len = c.len_utf8();
|
char_len = c.len_utf8();
|
||||||
|
|
||||||
let pos = TextSize::from(i as u32) + output_offset;
|
// The last element of `lines` represents the offset of the start of
|
||||||
|
// current line. To get the offset inside the line, we subtract it.
|
||||||
|
let pos = TextSize::from(i as u32) + output_offset
|
||||||
|
- lines.last().unwrap_or(&TextSize::default());
|
||||||
|
|
||||||
if char_len > 1 {
|
if char_len > 1 {
|
||||||
assert!((2..=4).contains(&char_len));
|
assert!((2..=4).contains(&char_len));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue