int (final Editor editor, final int tailOffset, final int delta) { final CaretModel model = editor.getCaretModel(); if (model.getOffset() == tailOffset) { model.moveToOffset(tailOffset + delta); } return tailOffset + delta; }