Avoid ICE when suggestion span is at Eof
This commit is contained in:
parent
03f19f7ff1
commit
eeb1bd18dc
3 changed files with 71 additions and 1 deletions
|
@ -229,7 +229,8 @@ impl CodeSuggestion {
|
|||
}
|
||||
}
|
||||
if let Some(cur_line) = fm.get_line(cur_lo.line - 1) {
|
||||
buf.push_str(&cur_line[..cur_lo.col.to_usize()]);
|
||||
let end = std::cmp::min(cur_line.len(), cur_lo.col.to_usize());
|
||||
buf.push_str(&cur_line[..end]);
|
||||
}
|
||||
}
|
||||
buf.push_str(&part.snippet);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue