boolean (@NotNull TextRange rangeInsideHost, @NotNull StringBuilder outChars) { final List<TextRange> ranges = myHost.getContentRanges(); final String content = rangeInsideHost.substring(myHost.getText()); myOffsets = new int[content.length() + 1]; Arrays.fill(myOffsets, -1); int i = 0; boolean decoded = false; for (TextRange range : ranges) { if (!rangeInsideHost.contains(range)) continue; for (int j = 0; j < range.getLength(); j++) { myOffsets[i ++] = range.getStartOffset() + j; } decoded = true; outChars.append(range.substring(myHost.getText())); } myOffsets[i] = rangeInsideHost.getEndOffset(); return decoded; }