Handle cross-frame codes

openid
Marcin Kulik 13 years ago
parent f6fa3cf145
commit 88d6e50033

@ -163,23 +163,13 @@ SP.AnsiInterpreter.prototype = {
}
if (handler) {
handler.call(this, data, match);
data = data.slice(match[0].length)
} else {
var s = data.slice(0, 10);
var hex = '';
for (i=0; i<s.length; i++) {
hex += '0x' + s[i].charCodeAt(0).toString(16) + ',';
}
console.log("failed matching: '" + s + "' (" + hex + ")");
throw 'bummer';
return;
return data;
}
}
return '';
}
}

@ -26,19 +26,31 @@ SP.Player.prototype = {
this.terminal.restartCursorBlink();
setTimeout(function() {
// console.log(this.dataIndex);
// console.log(this.currentData);
this.interpreter.feed(this.currentData);
var rest = this.interpreter.feed(this.currentData);
this.terminal.updateDirtyLines();
var n = timing[1];
console.log(timing[0]);
console.log(n);
this.currentData = this.data.slice(this.dataIndex, this.dataIndex + n);
if (rest.length > 0)
console.log('rest: ' + rest);
this.currentData = rest + this.data.slice(this.dataIndex, this.dataIndex + n);
this.dataIndex += n;
this.frame += 1;
if (rest.length > 20) {
var s = rest.slice(0, 10);
var hex = '';
for (i=0; i<s.length; i++) {
hex += '0x' + s[i].charCodeAt(0).toString(16) + ',';
}
console.log("failed matching: '" + s + "' (" + hex + ")");
return;
}
if (!window.stopped) {
this.nextFrame();
}
}.bind(this), timing[0] * 1000 * (1.0 / speed));
}
}

Loading…
Cancel
Save