diff --git a/main.ts b/main.ts index de32892..601d469 100644 --- a/main.ts +++ b/main.ts @@ -80,7 +80,8 @@ class NinjaCursorForWindow { textRange.setEndAfter(range.startContainer); let textRect = textRange.getBoundingClientRect(); if (textRect.x == 0 && textRect.y == 0) { - textRange.setStart(range.endContainer, range.endOffset - 1); + const startEndOffset = range.endOffset - 1 < 0 ? 0 : range.endOffset - 1; + textRange.setStart(range.endContainer, startEndOffset); textRange.setEnd(range.endContainer, range.endOffset); const textRects = textRange.getClientRects(); const tempRect = textRects.item(textRects.length - 1); diff --git a/manifest.json b/manifest.json index 3aafb38..fdeb26b 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "ninja-cursor", "name": "Ninja Cursor", - "version": "0.0.9", + "version": "0.0.10", "minAppVersion": "0.12.0", "description": "The plugin which enhance cursor visibility.", "author": "vorotamoroz", diff --git a/package-lock.json b/package-lock.json index abffa3e..a8e5f0c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ninja-cursor", - "version": "0.0.9", + "version": "0.0.10", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ninja-cursor", - "version": "0.0.9", + "version": "0.0.10", "license": "MIT", "devDependencies": { "@types/node": "^16.11.6", diff --git a/package.json b/package.json index 85e2b9e..2a44c60 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ninja-cursor", - "version": "0.0.9", + "version": "0.0.10", "description": "The plugin which enhance cursor visibility.", "main": "main.js", "scripts": {