trim terminal fix

This commit is contained in:
MeexReay 2025-03-21 20:06:44 +03:00
parent 60e7a7945d
commit 3487f1f7b0

View File

@ -18,7 +18,7 @@ async function cropToScreen(text, x, y, width, height) {
} }
async function printScreen(screen_length, start_cursor, pos, content, mode, pos, x, y, width, height) { async function printScreen(screen_length, start_cursor, pos, content, mode, pos, x, y, width, height) {
trimTerminal(getTerminal().length - screen_length) trimTerminal(screen_length)
let screen = await cropToScreen(content, 0, 0, width, height - 1) let screen = await cropToScreen(content, 0, 0, width, height - 1)
await writeStdout(screen) await writeStdout(screen)
let status_line = `\nmode: ${mode} | size: ${content.length} | lines: ${content.split("\n").length} | x: ${pos[0]} | y: ${pos[1]}` let status_line = `\nmode: ${mode} | size: ${content.length} | lines: ${content.split("\n").length} | x: ${pos[0]} | y: ${pos[1]}`
@ -73,7 +73,7 @@ async function main(args) {
} else if (event.type == "char") { } else if (event.type == "char") {
if (mode == "normal") { if (mode == "normal") {
if (event.char == ":") { if (event.char == ":") {
trimTerminal(getTerminal().length - status_length) trimTerminal(status_length)
writeStdout(":") writeStdout(":")
let command = readLine() let command = readLine()