void () { String promptWhenCommandStarted = myPrevPromptWhenCommandStarted; if (promptWhenCommandStarted != null) { processTerminalBuffer(terminalTextBuffer -> { TerminalLine line = myPrompt.getLineAtCursor(terminalTextBuffer); String lineStr = line.getText(); if (lineStr.startsWith(promptWhenCommandStarted)) { // A shown prompt probably suggests that last command has been terminated SaveAndSyncHandler.getInstance().scheduleRefresh(); myPrevPromptWhenCommandStarted = null; myVfsRefreshAlarm.cancelAllRequests(); getTerminalTextBuffer().removeModelListener(myVfsRefreshModelListener); } return null; }); } }