protected boolean bufferInput(int x, boolean echo) {
        // Intercept carriage returns.
        if (x == 13)
            return true;
        if ((x != 0 && x >= 32 && x <= 126) || x == 13 || x == 8 || x == 32 || x == 127) {
            if (x == 8 || x == 127) {
                try {
                    buffer = buffer.substring(0, buffer.length() - 1);
                    // Fixed backspace issue on Ship Name: prompt.
                    sendText(TrekAnsi.moveBackwards(1, this) + TrekAnsi.eraseToEndOfLine(this));
                } catch (StringIndexOutOfBoundsException oops) {
                    buffer = "";
                }
            } else {
                buffer += Character.toString((char) x);
                if (echo) {
                    sendText(Character.toString((char) x));
                }
            }
        }
        return false;
    }