modify tty line count so less displays everything

This commit is contained in:
Lisa Milne 2023-11-10 10:34:07 +10:00
parent 20737984e7
commit 836fd6340e
3 changed files with 17 additions and 14 deletions

View file

@ -311,7 +311,6 @@ Options:
stdio.close(fd);
var parts = txt.split('\n');
// TODO: split long lines
parts.forEach(function(line) {
if (line.length > tty.chars) {
var sects = line.match(new RegExp('(.{1,'+tty.chars+'})','g'));
@ -321,7 +320,7 @@ Options:
lines.push(line);
});
bottomLine = lines.length-tty.lines;
bottomLine = (lines.length-tty.lines);
showAt(0);
}

View file

@ -67,7 +67,7 @@ var clite = {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = name;
script.src = name+'?d='+(new Date).getTime();
script.onload = callback;
head.appendChild(script);
},
@ -78,7 +78,7 @@ var clite = {
return;
}
fetch(name)
fetch(name+'?d='+(new Date).getTime())
.then(response => response.text())
.then((data) => {
callback(data);
@ -205,6 +205,13 @@ data/about.txt:/usr/share/site/about:0:0:-rw-rw-r--`;
}else{
var fd = clite.io.open('/usr/share/introduction',function(fd) {
clite.user.genGuest();
clite.shell.writeLine(`
_____ _ _____ _
/ ____| | |_ _| |
| | | | | | | |_ ___
| | | | | | | __/ _ \\
| |____| |____ _| |_| || __/
\\_____|______|_____|\\__\\___|`);
if (!fd)
return;
var d = clite.io.readAll(fd);
@ -840,7 +847,11 @@ clite.term = {
var term = document.getElementById('terminal');
var p = term.parentNode;
tty.data.el.style.width = term.offsetWidth+'px';
tty.data.el.style.minHeight = term.offsetHeight+'px';
if (p.offsetHeight > term.offsetHeight) {
tty.data.el.style.minHeight = p.offsetHeight+'px';
}else{
tty.data.el.style.minHeight = term.offsetHeight+'px';
}
tty.data.el.style.position = 'absolute';
tty.data.el.style.top = term.offsetTop+'px';
tty.data.el.style.left = term.offsetLeft+'px';
@ -849,8 +860,8 @@ clite.term = {
var s = document.createElement('span');
s.innerText = 'W';
tty.data.el.appendChild(s);
tty.lines = tty.data.el.offsetHeight/s.offsetHeight;
tty.chars = (tty.data.el.offsetWidth/s.offsetWidth)*0.8;
tty.lines = parseInt((tty.data.el.offsetHeight/s.offsetHeight)*0.9);
tty.chars = parseInt((tty.data.el.offsetWidth/s.offsetWidth)*0.8);
tty.data.el.removeChild(s);
clite.events.refocus();
return tty;

View file

@ -1,7 +0,0 @@
<!--?php
if (!isset($_POST['CLITE_SESSION'])) {
?-->
<!--?php
}
?-->