IntList () { int endSegmentNumber = getTemplate().getEndSegmentNumber(); int selStart = getTemplate().getSelectionStartSegmentNumber(); int selEnd = getTemplate().getSelectionEndSegmentNumber(); IntList indices = new IntArrayList(); List<TemplateDocumentChange> changes = new ArrayList<>(); for (int i = 0; i < getTemplate().getSegmentsCount(); i++) { int length = getSegments().getSegmentEnd(i) - getSegments().getSegmentStart(i); if (length != 0) continue; if (i == endSegmentNumber || i == selStart || i == selEnd) continue; String name = getTemplate().getSegmentName(i); for (int j = 0; j < getTemplate().getVariableCount(); j++) { if (getTemplate().getVariableNameAt(j).equals(name)) { Expression e = getTemplate().getExpressionAt(j); String marker = "a"; if (e instanceof MacroCallNode) { marker = ((MacroCallNode)e).getMacro().getDefaultValue(); } changes.add(new TemplateDocumentChange(marker, getSegments().getSegmentStart(i), getSegments().getSegmentEnd(i), i)); indices.add(i); break; } } } executeChanges(changes); return indices; }