void () { DocumentEx document = (DocumentEx)getEditor().getDocument(); int textLength = document.getTextLength(); if (textLength <= 0) return; int startOffset = myRandom.nextInt(textLength); int endOffset = Math.min(textLength, startOffset + 1 + myRandom.nextInt(MAX_CHARS_PER_OPERATION)); int targetOffset = myRandom.nextInt(textLength + 1); if (targetOffset < startOffset || targetOffset > endOffset) { runWriteCommand(() -> document.moveText(startOffset, endOffset, targetOffset)); } }