Various improvements #169
1 changed files with 2 additions and 5 deletions
Fix +1
commit
67cdc18a11
|
|
@ -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}`
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue