int (@NotNull PostprocessFormattingTask o) { RangeMarker o1 = myRange; RangeMarker o2 = o.myRange; if (o1.equals(o2)) return 0; final int diff = o2.getEndOffset() - o1.getEndOffset(); if (diff == 0) { if (o1.getStartOffset() == o2.getStartOffset()) return 0; if (o1.getStartOffset() == o1.getEndOffset()) return -1; // empty ranges first if (o2.getStartOffset() == o2.getEndOffset()) return 1; // empty ranges first return o1.getStartOffset() - o2.getStartOffset(); } return diff; }