kopia lustrzana https://github.com/c9/core
Enable prediction after backspace on prompt
rodzic
2f338e2855
commit
ff501f79f8
|
@ -495,8 +495,18 @@ define(function(require, exports, module) {
|
||||||
if (lastInput
|
if (lastInput
|
||||||
&& (state === STATE_WAIT_FOR_PROMPT_OR_ECHO)
|
&& (state === STATE_WAIT_FOR_PROMPT_OR_ECHO)
|
||||||
&& lastInput === data.substr(data.length - lastInput.length)
|
&& lastInput === data.substr(data.length - lastInput.length)
|
||||||
&& (!BASH_ONLY || isBashActive())
|
&& checkTextBeforePrediction()
|
||||||
&& checkTextBeforePrediction()) {
|
&& (!BASH_ONLY || isBashActive())) {
|
||||||
|
if (DEBUG) console.log(" ^ re-enabled predictions:", lastInput);
|
||||||
|
return startPredict();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable predictions when we see echoing *and* a prompt
|
||||||
|
if (lastInput
|
||||||
|
&& state == STATE_WAIT_FOR_PROMPT
|
||||||
|
&& lastInput === data.substr(data.length - lastInput.length)
|
||||||
|
&& checkTextBeforePrediction()
|
||||||
|
&& isBashActive()) {
|
||||||
if (DEBUG) console.log(" ^ re-enabled predictions:", lastInput);
|
if (DEBUG) console.log(" ^ re-enabled predictions:", lastInput);
|
||||||
return startPredict();
|
return startPredict();
|
||||||
}
|
}
|
||||||
|
|
|
@ -547,6 +547,18 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "ace/test/asse
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("recovers after spurious backspaces on a prompt", function(done) {
|
||||||
|
predictor.once("nopredict", function() {
|
||||||
|
predictor.once("nopredict", function() {
|
||||||
|
assert.equal(session.$predictor.state, STATE_INITING);
|
||||||
|
afterPrompt(done);
|
||||||
|
send("\r");
|
||||||
|
});
|
||||||
|
send("Q");
|
||||||
|
});
|
||||||
|
send(INPUT_BACKSPACE);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!onload.remain) {
|
if (!onload.remain) {
|
||||||
|
|
Ładowanie…
Reference in New Issue