We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0ad2450 commit 6500487Copy full SHA for 6500487
lib/line-index/src/lib.rs
@@ -148,8 +148,8 @@ impl LineIndex {
148
/// e.g. if it points to the middle of a multi-byte character.
149
pub fn try_line_col(&self, offset: TextSize) -> Option<LineCol> {
150
let line = self.newlines.partition_point(|&it| it <= offset).checked_sub(1)?;
151
- let line_start_offset = self.newlines.get(line)?;
152
- let col = offset - line_start_offset;
+ let start = self.newlines.get(line)?;
+ let col = offset - start;
153
let ret = LineCol { line: line as u32, col: col.into() };
154
self.line_wide_chars
155
.get(&ret.line)
0 commit comments