@Override public void replaceSelection(String s) { // we got a bug report (#917) from a guy in Denmark who was getting NullPointerExceptions // when he types the ^ character on Mac OS X 10.6.2. Dunno what's that about, have not // seen it locally, but perhaps we can avoid the exception as follows. - ST 11/25/09 if (s == null) { super.replaceSelection(s); return; } // on Macs we're having problems with pasted text from other // apps having some weird nonstandard character at the // beginning we need to ignore - ST 1/3/06 if (s.length() > 0 && Character.getType(s.charAt(0)) == Character.FORMAT) { s = s.substring(1); } // Let's turn all tabs into spaces, because tabs are icky // and smartTabbing isn't happy with them. ~Forrest (10/4/2006) if (s.indexOf('\t') >= 0) { s = s.replaceAll("\t", " "); } super.replaceSelection(s); indenter.handleInsertion(s); }
void indentSelection() { indenter.handleTab(); }