Clamp UTF-16 coordinate while performing LSP edits rather than panicing

This commit is contained in:
Julia 2022-11-15 14:11:52 -05:00
parent 0078bea877
commit f9cbed5a1f
3 changed files with 46 additions and 14 deletions

View file

@ -5743,7 +5743,7 @@ impl Project {
// of any anchors positioned in the unchanged regions.
if range.end.row > range.start.row {
let mut offset = range.start.to_offset(&snapshot);
let old_text = snapshot.text_for_range(range).collect::<String>();
let old_text = snapshot.text_for_clamped_range(range).collect::<String>();
let diff = TextDiff::from_lines(old_text.as_str(), &new_text);
let mut moved_since_edit = true;