kopia lustrzana https://github.com/c9/core
Improve debuggability
rodzic
726a40fb87
commit
bfd5aa7f44
|
@ -160,6 +160,9 @@ define(function(require, exports, module) {
|
|||
+ "%c" + predictLine,
|
||||
"color: lightblue");
|
||||
|
||||
// DEBUG && console.log("!="
|
||||
// + session.terminal.$debugCharsAt(predictStartY - session.terminal.ybase).join(""));
|
||||
|
||||
command.timeout = setTimeout(function panic() {
|
||||
if (!c9.has(c9.NETWORK) || !c9.connected) {
|
||||
state = STATE_WAIT_FOR_ECHO;
|
||||
|
@ -219,13 +222,17 @@ define(function(require, exports, module) {
|
|||
|
||||
pong();
|
||||
|
||||
var result;
|
||||
chopPredictions(e, predictions, function(err, _result) {
|
||||
result = _result;
|
||||
if (err || !result) {
|
||||
DEBUG && console.log("[predict_echo] mispredict?", e.data.replace(/\r/g, "\\r"),
|
||||
"\n@", nonPredictTerminal.$debugCharsAt(e.$startY).join(""));
|
||||
emit("mispredict", { data: e.data, predictions: predictions, session: session });
|
||||
chopPredictions(e, predictions, function(err, results, line) {
|
||||
if (err || !results) {
|
||||
DEBUG && console.log("[predict_echo] mispredict?", e.data.replace(/\r/g, "\\r")
|
||||
+ "\n!=" + session.terminal.$debugCharsAt(predictStartY - session.terminal.ybase).join("")
|
||||
+ "\n<=" + nonPredictTerminal.$debugCharsAt(e.$startY).join(""));
|
||||
emit("mispredict", {
|
||||
data: e.data,
|
||||
line: charsOf(line),
|
||||
predictions: predictions,
|
||||
session: session
|
||||
});
|
||||
undoPredictions();
|
||||
}
|
||||
// I would try to enable predictions here,
|
||||
|
@ -244,7 +251,7 @@ define(function(require, exports, module) {
|
|||
/**
|
||||
* Temporarily restore the unpredict terminal state to allow
|
||||
* writing incoming data, including small anomalies that may
|
||||
* not have been predict but still passed our sanity checks.
|
||||
* not have been predicted but still passed our sanity checks.
|
||||
*/
|
||||
function writePredictData(data, startX) {
|
||||
var predictTerminal = session.terminal;
|
||||
|
|
|
@ -376,8 +376,8 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "ace/test/asse
|
|||
afterPredict("[", function() {
|
||||
afterPredict("[", function() {
|
||||
assert.equal(peek(-1), " ");
|
||||
assert.equal(peek(), "e");
|
||||
assert.equal(peek(1), "c");
|
||||
assert.equal(peek(), "#");
|
||||
assert.equal(peek(1), "p");
|
||||
|
||||
afterPrompt(done);
|
||||
send("\r");
|
||||
|
@ -387,16 +387,16 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "ace/test/asse
|
|||
sendAll([INPUT_RIGHT]);
|
||||
});
|
||||
|
||||
sendAll(["eecho bleep", INPUT_HOME]);
|
||||
sendAll(["##print some chars; home; right; backspace", INPUT_HOME]);
|
||||
});
|
||||
|
||||
it("supports insert with repeated characters; stress test", function loop(done, attempt) {
|
||||
it("supports insert with repeated characters (prxaat); stress test", function loop(done, attempt) {
|
||||
this.timeout && this.timeout(60000);
|
||||
session.$predictor.state = 0;
|
||||
if (attempt === 5)
|
||||
return done();
|
||||
|
||||
sendAll("echo blaat".split(""), function() {
|
||||
sendAll("echo praat".split(""), function() {
|
||||
var sawX;
|
||||
|
||||
afterPredict("t", function() {
|
||||
|
@ -405,8 +405,9 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "ace/test/asse
|
|||
});
|
||||
predictor.on("predict", function wait(e) {
|
||||
sawX = sawX || e.data.match(/x/);
|
||||
if (!sawX || e.data.match(/xaat/) || !e.data.match(/a/))
|
||||
return; // console.log(" -", e.data, sawX)*
|
||||
// Wait until we've seen an 'x' and then an 'a'
|
||||
if (!sawX || e.data.match(/xaat$/))
|
||||
return console.log(" -", e.data, !!sawX);
|
||||
predictor.off("predict", wait);
|
||||
|
||||
assert.equal(peek(), "a");
|
||||
|
|
Ładowanie…
Reference in New Issue