in core/src/com/jediterm/core/typeahead/TerminalTypeAheadManager.java [40:86]
public void onTerminalStateChanged() {
if (!myTerminalModel.isTypeAheadEnabled() || myOutOfSyncDetected) return;
myTerminalModel.lock();
try {
if (myTerminalModel.isUsingAlternateBuffer()) {
resetState();
return;
}
TypeAheadTerminalModel.LineWithCursorX lineWithCursorX = myTerminalModel.getCurrentLineWithCursor();
if (!myPredictions.isEmpty()) {
updateLeftMostCursorPosition(lineWithCursorX.myCursorX);
if (myClearPredictionsDebouncer != null) {
myClearPredictionsDebouncer.call();
}
}
if (myLastSuccessfulPrediction != null && lineWithCursorX.equals(myLastSuccessfulPrediction.myPredictedLineWithCursorX)) {
return;
}
ArrayList<TypeAheadPrediction> removedPredictions = new ArrayList<>();
while (!myPredictions.isEmpty() && !lineWithCursorX.equals(myPredictions.get(0).myPredictedLineWithCursorX)) {
removedPredictions.add(myPredictions.remove(0));
}
if (myPredictions.isEmpty()) {
myOutOfSyncDetected = true;
resetState();
} else {
myLastSuccessfulPrediction = myPredictions.remove(0);
removedPredictions.add(myLastSuccessfulPrediction);
for (TypeAheadPrediction prediction : removedPredictions) {
myLatencyStatistics.adjustLatency(prediction);
if (prediction instanceof CharacterPrediction) {
myIsNotPasswordPrompt = true;
}
}
applyPredictions();
}
} finally {
myTerminalModel.unlock();
}
}