* Splits and returns the second.
* If split point at a node boundary, doesn't split, but returns the next nodelet.
*/
private Text implSplitText(int offset) {
findNodeletWithOffset(offset, nodeletOffsetOutput, getRepairer());
Text text = nodeletOffsetOutput.getNode().<Text>cast();
if (text.getLength() == nodeletOffsetOutput.getOffset()) {
return text.getNextSibling().cast();
} else if (nodeletOffsetOutput.getOffset() == 0) {
return text;
} else {
int nodeletOffset = nodeletOffsetOutput.getOffset();
Text ret = text.splitText(nodeletOffset);
// -10000 because the number should be ignored in the splitText case,
// so some large number to trigger an error if it is not ignored.
getExtendedContext().editing().textNodeletAffected(
text, nodeletOffset, -10000, TextNodeChangeType.SPLIT);
return ret;