@Override
    protected TerminalSize calculatePreferredSize() {
        if (lockPreferredSize) {
            return requestedSize;
        }
        TerminalSize ts = getDataSize();
        if (ts.getColumns() < minimumCols) {
            ts.setColumns(minimumCols);
        }
        if (ts.getRows() < minimumRows) {
            ts.setRows(minimumRows);
        }

        if (ts.getColumns() < requestedSize.getColumns()) {
            ts.setColumns(requestedSize.getColumns());
        }
        if (ts.getRows() < requestedSize.getRows()) {
            ts.setRows(requestedSize.getRows());
        }

        return ts;
    }