void () { final CharSequence contents = myDelegate.getOriginalText(); int pos = 0; myNewLine = true; myCurrentIndent = 0; while (pos < contents.length()) { char ch = contents.charAt(pos++); switch (ch) { case ' ': case '\t': myCurrentIndent++; break; case '\n': case '\r': myCurrentIndent = 0; break; default: return; } } }