This commit is contained in:
Andras Schmelczer 2025-11-22 20:03:09 +00:00
commit c3c2cafde5

View file

@ -16,11 +16,8 @@ export function positionToLineAndColumn(
text = text.replaceAll("\r", ""); text = text.replaceAll("\r", "");
if ( if (position > text.length) {
position > // position == text.length accounts for the cursor being after last character
text.length + 1
// +1 to account for the cursor being after last character
) {
throw new Error( throw new Error(
`Position ${position} exceeds text length ${text.length}` `Position ${position} exceeds text length ${text.length}`
); );