public void onKeyEvent(@NotNull TypeAheadEvent keyEvent) {
        if (!myTerminalModel.isTypeAheadEnabled()) return;
        myTerminalModel.lock();
        try {
            if (myTerminalModel.isUsingAlternateBuffer()) {
                resetState();
                return;
            }
            TypeAheadTerminalModel.LineWithCursorX lineWithCursorX = myTerminalModel.getCurrentLineWithCursor();
            long prevTypedTime = myLastTypedTime;
            myLastTypedTime = System.nanoTime();
            long autoSyncDelay;
            if (myLatencyStatistics.getSampleSize() >= LATENCY_MIN_SAMPLES_TO_TURN_ON) {
                autoSyncDelay = Math.min(myLatencyStatistics.getMaxLatency(), MAX_TERMINAL_DELAY);
            } else {
                autoSyncDelay = MAX_TERMINAL_DELAY;
            }
            boolean hasTypedRecently = System.nanoTime() - prevTypedTime < autoSyncDelay;
            if (hasTypedRecently) {
                if (myOutOfSyncDetected) {
                    return;
                }
            } else {
                myOutOfSyncDetected = false;
            }
            reevaluatePredictorState(hasTypedRecently);
            updateLeftMostCursorPosition(lineWithCursorX.myCursorX);
            if (myPredictions.isEmpty() && myClearPredictionsDebouncer != null) {
                myClearPredictionsDebouncer.call(); // start a timer that will clear predictions
            }
            TypeAheadPrediction prediction = createPrediction(lineWithCursorX, keyEvent);
            myPredictions.add(prediction);
            applyPredictions();
            logger.debug("Created " + keyEvent.myEventType + " prediction");
        } finally {
            myTerminalModel.unlock();
        }
    }
@Test
    public void testTentativeCursorMovePrediction() throws Exception {
        new TestRunner() {

            @Override
            void run() {
                model.insertString("a");
                manager.onKeyEvent(new TypeAheadEvent(TypeAheadEvent.EventType.LeftArrow));
                assertFalse(didDrawPredictions());
            }
        }.fillLatencyStats().setIsNotPasswordPrompt().run();
    }