Working on better compatibility (now compliant with all the vttest test #1)

This commit is contained in:
Florian Mounier
2015-05-15 12:43:02 +02:00
parent 89a7e05f55
commit 354280bbda
4 changed files with 37 additions and 5 deletions

8
butterfly/bin/bhtml Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env python
from butterfly.escapes import html
import fileinput
import sys
with html():
for line in fileinput.input():
sys.stdout.write(line)

View File

@@ -1053,6 +1053,19 @@
if (ch === "$" || ch === "\"" || ch === " " || ch === "'") {
break;
}
if (ch <= " " || ch >= "~") {
if (ch === '\b') {
this.currentParam = (this.currentParam / 10) & 1;
}
if (ch === '\r') {
this.x = 0;
}
if (["\n", "\x0b", "\x0c"].indexOf(ch) >= 0) {
this.screen[this.y + this.shift].dirty = true;
this.nextLine();
}
break;
}
this.params.push(this.currentParam);
this.currentParam = 0;
if (ch === ";") {
@@ -1174,7 +1187,7 @@
}
break;
default:
console.error("Unknown CSI code: %s.", ch);
console.error("Unknown CSI code: %s (%d).", ch, ch.charCodeAt(0));
}
this.prefix = "";
break;

File diff suppressed because one or more lines are too long

View File

@@ -877,6 +877,18 @@ class Terminal
# '$', '"', ' ', '\''
if ch is "$" or ch is "\"" or ch is " " or ch is "'"
break
# Ignore garbage characters
if ch <= " " or ch >= "~"
if ch is '\b'
@currentParam = (@currentParam / 10) & 1
if ch is '\r'
@x = 0
if ["\n", "\x0b", "\x0c"].indexOf(ch) >= 0
@screen[@y + @shift].dirty = true
@nextLine()
break
@params.push @currentParam
@currentParam = 0
@@ -1064,7 +1076,7 @@ class Terminal
@softReset @params
else
console.error "Unknown CSI code: %s.", ch
console.error "Unknown CSI code: %s (%d).", ch, ch.charCodeAt(0)
@prefix = ""
when State.dcs