boolean (Object component, String text, String insert, int movestart, int moveend, int start, int end) { if ((insert == null) && (start == movestart) && (end == moveend)) { return false; } movestart = Math.max(0, Math.min(movestart, text.length())); moveend = Math.max(0, Math.min(moveend, text.length())); if (insert != null) { int min = Math.min(movestart, moveend); set(component, "text", text.substring(0, min) + insert + text.substring(Math.max(movestart, moveend))); movestart = moveend = min + insert.length(); invoke(component, "action"); } if (start != movestart) { setInteger(component, "start", movestart, 0); } if (end != moveend) { setInteger(component, "end", moveend, 0); } if ((insert != null) || (start != movestart) || (end != moveend)) { validate(component); } return true; }