fix bug with prompt being written to terminal

This commit is contained in:
Lisa Milne 2023-12-08 18:28:01 +10:00
parent b032d45b63
commit d2ba616d4f
2 changed files with 9 additions and 8 deletions

View file

@ -1,6 +1,6 @@
var clite = {
state:{
version:'0.3-7',
version:'0.3.8',
isinit:false,
runlevel:1
},
@ -43,13 +43,13 @@ var clite = {
clite.term.setCustom({type:'file',callback:callback});
clite.term.writeLine('open file: '+name);
return;
// fuck it, I'll just update about:config in firefox
}
fetch(name+'?d='+(new Date).getTime())
.then(response => response.text())
.then((data) => {
.then(function(response) {
return response.text();
})
.then(function(data) {
callback(data);
});
}
@ -2260,7 +2260,7 @@ clite.term = {
f = document.createElement('form');
f.id = 'form';
f.innerHTML = '';
if (!clite.term.isalt) {
if (!clite.term.data.isalt) {
var l = document.createElement('label');
l.innerHTML = clite.lib.htmlEncode(clite.term.data.prompt);
f.appendChild(l);

View file

@ -260,10 +260,10 @@ clite.commands.load('sh',function(args,env,io) {
}
history.add(txt);
history.resetCurrent();
if (interactive)
stdio.write(io.stdout,prompt+txt);
// clear the tty prompt
term.ttyctrl('prompt','');
if (interactive)
stdio.write(io.stdout,prompt+txt);
// split command line into arguments
var args = clite.strToArgs(txt);
args.forEach(function(val,i) {
@ -322,6 +322,7 @@ clite.commands.load('sh',function(args,env,io) {
stdio.write(io.stderr,'Shell: internal error');
if (interactive)
inputRead();
return;
}
stdlib.waitpid(pid,inputRead);
}