Fix +1
This commit is contained in:
parent
28a72513d1
commit
67cdc18a11
1 changed files with 2 additions and 5 deletions
|
|
@ -16,11 +16,8 @@ export function positionToLineAndColumn(
|
|||
|
||||
text = text.replaceAll("\r", "");
|
||||
|
||||
if (
|
||||
position >
|
||||
text.length + 1
|
||||
// +1 to account for the cursor being after last character
|
||||
) {
|
||||
if (position > text.length) {
|
||||
// position == text.length accounts for the cursor being after last character
|
||||
throw new Error(
|
||||
`Position ${position} exceeds text length ${text.length}`
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue