int nextTabStop(int pos) {
        int tabWidth = TAB_WIDTH;
        int width = getTerminal().getWidth();
        int mod = (pos + tabWidth - 1) % tabWidth;
        int npos = pos + tabWidth - mod;
        return npos < width ? npos - pos : width - pos;
    }