Skip to content

Commit

Permalink
improve: line number bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
alondmnt committed Apr 18, 2024
1 parent df7fff8 commit 352fd40
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/codeMirror6Scroller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export default (context: ContentScriptContext): MarkdownEditorContentScriptModul
console.log('scrollToLine', lineNumber);

// Bounds checking
if (lineNumber < 0) {
lineNumber = 0;
if (lineNumber < 1) {
lineNumber = 1;
}
if (lineNumber > editor.state.doc.lines) {
lineNumber = editor.state.doc.lines;
Expand Down

0 comments on commit 352fd40

Please sign in to comment.