correction of [x;yH ANSI code

This commit is contained in:
overflowerror 2013-07-20 21:58:19 +02:00
parent 8fb7da7044
commit 0dd143053a
4 changed files with 20 additions and 16 deletions

View file

@ -51,7 +51,7 @@ Emulator.kill = function() {
Emulator.shutdown = function() {
Emulator.running = false;
Emulator.startable = true;
Emulator.output("\033[0m\033[2J\033[0:0H");
Emulator.output("\033[0m\033[2J\033[0;0H");
Emulator.Output.cursorOff()
}
Emulator.addEventHandlers = function() {
@ -158,7 +158,7 @@ Emulator.ANSISequences.output = function(text) {
break;
}
if (specialText.length < 1) {
normalText += " [" + ((specialText2.length > 0) ? (specialText2 + ":") : "") + specialText;
normalText += " [" + ((specialText2.length > 0) ? (specialText2 + ";") : "") + specialText;
state = 0;
break;
}
@ -238,7 +238,7 @@ Emulator.ANSISequences.output = function(text) {
specialText2 = "";
state = 0;
break;
case ':':
case ';':
// TODO Wrong!
specialText2 = specialText;
specialText = "";
@ -306,7 +306,7 @@ Emulator.ANSISequences.output = function(text) {
Emulator.Output.cursorOn();
break;
default:
normalText = " [" + ((specialText2.length > 0) ? (specialText2 + ":") : "") + specialText;
normalText = " [" + ((specialText2.length > 0) ? (specialText2 + ";") : "") + specialText;
break;
}
specialText = "";
@ -377,7 +377,7 @@ Emulator.ANSISequences.output = function(text) {
Emulator.Output.backgroundColor = "#fff";
break;
default:
normalText += " [" + ((specialText2.length > 0) ? (specialText2 + ":") : "") + specialText;
normalText += " [" + ((specialText2.length > 0) ? (specialText2 + ";") : "") + specialText;
state = 0;
break;
}
@ -386,7 +386,7 @@ Emulator.ANSISequences.output = function(text) {
state = 0;
break;
default:
normalText += " [" + ((specialText2.length > 0) ? (specialText2 + ":") : "") + specialText;
normalText += " [" + ((specialText2.length > 0) ? (specialText2 + ";") : "") + specialText;
state = 0;
break;
}
@ -426,7 +426,7 @@ Emulator.ANSISequences.output = function(text) {
}
}
if ((specialText2.length || specialText.length) > 0)
normalText += " [" + ((specialText2.length > 0) ? (specialText2 + ":") : "") + specialText;
normalText += " [" + ((specialText2.length > 0) ? (specialText2 + ";") : "") + specialText;
Emulator.Output.normalOutput(normalText);
}

View file

@ -26,7 +26,7 @@ Loader.main = function(device) {
console.log("Loader: register key interrupt");
Emulator.interrupts['key'] = Loader.key;
Loader.device = device;
var text = "\033[2J\033[0:0H\033[?25l" + Loader.logo + "\033[s";
var text = "\033[2J\033[0;0H\033[?25l" + Loader.logo + "\033[s";
Emulator.output(text);
Loader.state = 0;
}

View file

@ -49,7 +49,7 @@ Kernel.machine = function() {
switch(Kernel.state) {
case 0:
Emulator.Output.shiftKey = OS.staticShift;
Emulator.output("\033[2J\033[0:0H" + OS.logo);
Emulator.output("\033[2J\033[0;0H" + OS.logo);
Kernel.msgOut("reseting kernel timer", true);
Kernel.time = 0;
Kernel.msgOut("register main timer (100ms)", true); // pre
@ -356,22 +356,26 @@ Kernel.Filesystem.update = function(path) {
Kernel.Filesystem.files[path] = file;
return file;
}
Kernel.Filesystem.getRealPath = function(name) {
Kernel.Filesystem.shortenPath = function(name) {
var index;
while ((index = name.indexOf("/../")) != -1) {
name = name.replace("/../", "/");
var index2 = 0;
var index3 = 0;
var index3 = -1;
while(index2 < index) {
index3 = index2;
index2 = name.indexOf("/", index3);
index2 = name.indexOf("/", index3 + 1);
}
if (!index3)
if (index3 == -1)
return undefined;
name = name.substring(index3, index);
name = name.substring(0, index3) + name.substring(index);
}
while ((index = name.indexOf("/./")) != -1)
name = name.replace("/./", "/");
return name;
}
Kernel.Filesystem.getRealPath = function(name) {
name = Kernel.Filesystem.shortenPath(name);
return Kernel.Filesystem.root + name;
}
Kernel.Filesystem.addTTY = function(path, output, input) {
@ -411,7 +415,7 @@ Kernel.Filesystem.getDirectory = function(path) {
response = JSON.parse(response);
if (response.error) {
console.log("Kernel: error on reading: " + response.error);
return response.error;
return response;
}
return response;

View file

@ -20,7 +20,7 @@ LoginClass.prototype.tick = function() {
var stdin = this.files['stdin'];
switch(this.state) {
case 0:
stdout.write("\033[?25h\033[0:0H");
stdout.write("\033[?25h\033[0;0H");
if (OS.staticShift)
stdout.write("\033[0:" + (OS.staticShift - 1) + "H");
stdout.write("\033[0J");