Fix issue when applying edits to last line

Authored by: @memeplex

See also #860
This commit is contained in:
Riccardo Ferretti
2021-12-22 23:11:03 +01:00
parent 0ada7d8e2c
commit f613e1b9e2

View File

@@ -34,5 +34,5 @@ const getOffset = (
offset = offset + lines[i].length + eolLen;
i++;
}
return offset + Math.min(position.character, lines[i].length);
return offset + Math.min(position.character, lines[i]?.length ?? 0);
};