document.replace(offset, length, new String(chars));
LinkedModeModel model = new LinkedModeModel();
LinkedPositionGroup group = new LinkedPositionGroup();
group.addPosition(new LinkedPosition(document, offset + 1, 0, LinkedPositionGroup.NO_STOP));
model.addGroup(group);
model.forceInstall();
LinkedModeUI ui = new LinkedModeUI(model, viewer);
ui.setCyclingMode(LinkedModeUI.CYCLE_NEVER);
ui.setExitPosition(viewer, offset + 2, 0, Integer.MAX_VALUE);
ui.setExitPolicy(getExitPolicy(mc, getEscapeChar(c), document));