mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-11 07:14:04 +09:00
edit.js: hor scroll also works; what left is doing vert scroll when col > 0
This commit is contained in:
@@ -43,11 +43,11 @@ if (editingExistingFile) {
|
|||||||
textbuffer = filesystem.readAll(driveLetter).split("\n");
|
textbuffer = filesystem.readAll(driveLetter).split("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
let windowWidth = con.getmaxyx()[1];
|
let windowWidth = 0;
|
||||||
let windowHeight = con.getmaxyx()[0];
|
let windowHeight = 0;
|
||||||
let paintWidth = windowWidth - PAINT_START_X + 1;
|
let paintWidth = 0;
|
||||||
let paintHeight = windowHeight - PAINT_START_Y + 1;
|
let paintHeight = 0;
|
||||||
let scrollPeek = Math.ceil((paintHeight / 7));
|
let scrollPeek = 0;
|
||||||
function drawInit() {
|
function drawInit() {
|
||||||
windowWidth = con.getmaxyx()[1];
|
windowWidth = con.getmaxyx()[1];
|
||||||
windowHeight = con.getmaxyx()[0];
|
windowHeight = con.getmaxyx()[0];
|
||||||
@@ -300,7 +300,7 @@ function cursorMoveRelative(odx, ody) {
|
|||||||
|
|
||||||
// set new dx if destination col is outside of the line
|
// set new dx if destination col is outside of the line
|
||||||
if (cursorCol + dx > textbuffer[cursorRow + dy].length)
|
if (cursorCol + dx > textbuffer[cursorRow + dy].length)
|
||||||
dx -= (cursorCol + dx) - textbuffer[cursorRow].length + 1
|
dx = textbuffer[cursorRow].length - cursorCol;
|
||||||
else if (cursorCol + dx < 0)
|
else if (cursorCol + dx < 0)
|
||||||
dx = -cursorCol;
|
dx = -cursorCol;
|
||||||
|
|
||||||
@@ -352,7 +352,7 @@ function cursorMoveRelative(odx, ody) {
|
|||||||
drawTextbuffer(); drawLineNumbers();
|
drawTextbuffer(); drawLineNumbers();
|
||||||
}
|
}
|
||||||
else if (oldScrollHor != scrollHor) {
|
else if (oldScrollHor != scrollHor) {
|
||||||
drawTextLine(ny);
|
drawTextLine(cursorRow - scroll);
|
||||||
}
|
}
|
||||||
// remove old caret highlights
|
// remove old caret highlights
|
||||||
if (dy != 0 && COL_CARET_ROW !== undefined) {
|
if (dy != 0 && COL_CARET_ROW !== undefined) {
|
||||||
|
|||||||
Reference in New Issue
Block a user