|
|
@ -567,7 +567,6 @@ impl LanguageLayer {
|
|
|
|
) -> Vec<tree_sitter::InputEdit> {
|
|
|
|
) -> Vec<tree_sitter::InputEdit> {
|
|
|
|
use Operation::*;
|
|
|
|
use Operation::*;
|
|
|
|
let mut old_pos = 0;
|
|
|
|
let mut old_pos = 0;
|
|
|
|
let mut new_pos = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let mut edits = Vec::new();
|
|
|
|
let mut edits = Vec::new();
|
|
|
|
|
|
|
|
|
|
|
@ -611,9 +610,7 @@ impl LanguageLayer {
|
|
|
|
let mut old_end = old_pos + len;
|
|
|
|
let mut old_end = old_pos + len;
|
|
|
|
|
|
|
|
|
|
|
|
match change {
|
|
|
|
match change {
|
|
|
|
Retain(_) => {
|
|
|
|
Retain(_) => {}
|
|
|
|
new_pos += len;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Delete(_) => {
|
|
|
|
Delete(_) => {
|
|
|
|
let (start_byte, start_position) = point_at_pos(old_text, old_pos);
|
|
|
|
let (start_byte, start_position) = point_at_pos(old_text, old_pos);
|
|
|
|
let (old_end_byte, old_end_position) = point_at_pos(old_text, old_end);
|
|
|
|
let (old_end_byte, old_end_position) = point_at_pos(old_text, old_end);
|
|
|
@ -637,8 +634,6 @@ impl LanguageLayer {
|
|
|
|
Insert(s) => {
|
|
|
|
Insert(s) => {
|
|
|
|
let (start_byte, start_position) = point_at_pos(old_text, old_pos);
|
|
|
|
let (start_byte, start_position) = point_at_pos(old_text, old_pos);
|
|
|
|
|
|
|
|
|
|
|
|
let ins = s.chars().count();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// a subsequent delete means a replace, consume it
|
|
|
|
// a subsequent delete means a replace, consume it
|
|
|
|
if let Some(Delete(len)) = iter.peek() {
|
|
|
|
if let Some(Delete(len)) = iter.peek() {
|
|
|
|
old_end = old_pos + len;
|
|
|
|
old_end = old_pos + len;
|
|
|
@ -666,8 +661,6 @@ impl LanguageLayer {
|
|
|
|
new_end_position: traverse(start_position, s), // old pos + chars, newlines matter too (iter over)
|
|
|
|
new_end_position: traverse(start_position, s), // old pos + chars, newlines matter too (iter over)
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
new_pos += ins;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
old_pos = old_end;
|
|
|
|
old_pos = old_end;
|
|
|
|