List<String> (boolean aboveCursorLine) { List<String> screenLines = new ArrayList<>(); myBuffer.lock(); try { int cursorLineInd = myTerminal.getCursorY() - 1; for (int row = 0; row < myBuffer.getHeight(); row++) { if (!aboveCursorLine || row < cursorLineInd) { TerminalLine line = myBuffer.getLine(row); screenLines.add(line.getText()); } } } finally { myBuffer.unlock(); } return screenLines; }