mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-12 15:44:05 +09:00
edit.js: cosmetic fix
This commit is contained in:
@@ -24,12 +24,18 @@ if (editingExistingFile) {
|
|||||||
serial.println(textbuffer);
|
serial.println(textbuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let windowWidth = con.getmaxyx()[1];
|
let windowWidth = con.getmaxyx()[1];
|
||||||
let windowHeight = con.getmaxyx()[0];
|
let windowHeight = con.getmaxyx()[0];
|
||||||
let paintWidth = windowWidth - 4;
|
let paintWidth = windowWidth - 4;
|
||||||
let paintHeight = windowHeight - 1;
|
let paintHeight = windowHeight - 1;
|
||||||
let scrollPeek = Math.ceil((paintHeight / 7));
|
let scrollPeek = Math.ceil((paintHeight / 7));
|
||||||
|
function drawInit() {
|
||||||
|
windowWidth = con.getmaxyx()[1];
|
||||||
|
windowHeight = con.getmaxyx()[0];
|
||||||
|
paintWidth = windowWidth - 4;
|
||||||
|
paintHeight = windowHeight - 1;
|
||||||
|
scrollPeek = Math.ceil((paintHeight / 7));
|
||||||
|
}
|
||||||
|
|
||||||
//const menubarItems = ["File","Edit","View"];
|
//const menubarItems = ["File","Edit","View"];
|
||||||
const menubarItems = [`^S${String.fromCharCode(221)}save`,`^X${String.fromCharCode(221)}exit`];
|
const menubarItems = [`^S${String.fromCharCode(221)}save`,`^X${String.fromCharCode(221)}exit`];
|
||||||
@@ -54,17 +60,9 @@ function reset_status() {
|
|||||||
|
|
||||||
// DRAWING FUNCTIONS //
|
// DRAWING FUNCTIONS //
|
||||||
|
|
||||||
function drawInit() {
|
|
||||||
windowWidth = con.getmaxyx()[1];
|
|
||||||
windowHeight = con.getmaxyx()[0];
|
|
||||||
scrollPeek = Math.ceil((paintHeight / 6));
|
|
||||||
paintWidth = windowWidth-4;
|
|
||||||
paintHeight = windowHeight-2;
|
|
||||||
}
|
|
||||||
|
|
||||||
function drawLineNumbers() {
|
function drawLineNumbers() {
|
||||||
con.color_pair(COL_LNUMFORE, COL_LNUMBACK);
|
con.color_pair(COL_LNUMFORE, COL_LNUMBACK);
|
||||||
for (let y = 0; y <= paintHeight; y++) {
|
for (let y = 0; y < paintHeight; y++) {
|
||||||
con.move(y+2, 1);
|
con.move(y+2, 1);
|
||||||
let lnum = scroll + y + 1;
|
let lnum = scroll + y + 1;
|
||||||
if (lnum >= 1000) print(`${lnum}`);
|
if (lnum >= 1000) print(`${lnum}`);
|
||||||
@@ -185,7 +183,7 @@ function displayBulletin(text) {
|
|||||||
}
|
}
|
||||||
function dismissBulletin() {
|
function dismissBulletin() {
|
||||||
bulletinShown = false;
|
bulletinShown = false;
|
||||||
drawTextLine(paintHeight - 1);
|
drawTextLine(paintHeight - 2);
|
||||||
gotoText();
|
gotoText();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,7 +233,7 @@ function appendLine() {
|
|||||||
cursorCol = 0;
|
cursorCol = 0;
|
||||||
drawLnCol();
|
drawLnCol();
|
||||||
|
|
||||||
if (cursorRow > windowHeight - scrollPeek) {
|
if (cursorRow >= windowHeight - scrollPeek) {
|
||||||
scroll += 1;
|
scroll += 1;
|
||||||
drawLineNumbers();
|
drawLineNumbers();
|
||||||
drawTextbuffer();
|
drawTextbuffer();
|
||||||
|
|||||||
Reference in New Issue
Block a user