Enable prediction after backspace on prompt

pull/449/head
Lennart Kats 2017-07-05 19:52:32 +00:00
rodzic 2f338e2855
commit ff501f79f8
2 zmienionych plików z 24 dodań i 2 usunięć

Wyświetl plik

@ -495,8 +495,18 @@ define(function(require, exports, module) {
if (lastInput
&& (state === STATE_WAIT_FOR_PROMPT_OR_ECHO)
&& 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);
return startPredict();
}

Wyświetl plik

@ -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) {