presto-cli/src/main/java/io/prestosql/cli/AlignedTablePrinter.java/AlignedTablePrinter/consoleWidth
class AlignedTablePrinter:    static int consoleWidth(String s)
    {
        CharSequence plain = stripAnsi(s);
        int n = 0;
        for (int i = 0; i < plain.length(); i++) {
            n += max(wcwidth(plain.charAt(i)), 0);
        }
        return n;
    }