Skip to content

Commit

Permalink
add page up/down scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
kjloveless committed Nov 12, 2024
1 parent 5824e22 commit da42cdd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,15 @@ function editorProcessKeypress() {

case EditorKey.PAGE_UP:
case EditorKey.PAGE_DOWN:
if (char == EditorKey.PAGE_UP) {
e.cursorY = e.rowOffset;
} else if (char == EditorKey.PAGE_DOWN) {
e.cursorY = e.rowOffset + e.screenRows - 1;
if (e.cursorY > e.numRows) {
e.cursorY = e.numRows;
}
}

let times = e.screenRows;
while (times--) {
editorMoveCursor(char == EditorKey.PAGE_UP ? EditorKey.ARROW_UP : EditorKey.ARROW_DOWN);
Expand Down

0 comments on commit da42cdd

Please sign in to comment.