private void updateEditorHighlights(final List<DataRange> highlights) {
        if (highlights != null) {
            final BooleanSupplier isSingleLineData = () -> receivedSourceLocation.getOptDataRange()
                    .flatMap(DataRange::getLineCount)
                    .filter(lineCount -> lineCount == 1)
                    .isPresent();

            final BooleanSupplier isNonZeroCharOffset = () -> receivedSourceLocation.getOptDataRange()
                    .flatMap(DataRange::getOptCharOffsetFrom)
                    .filter(charOffset -> charOffset > 0)
                    .isPresent();

            // This is the highlight range for the editor, not the source data. For single line
            // data they will differ if the editor is not displaying from offset one.
            // It is only an issue for single line data because for multi-line we adjust the editor's
            // starting line no to suit the data.
            final List<TextRange> textRanges = new ArrayList<>();
            for (final DataRange highlight : highlights) {
                TextRange editorHighlight = highlight.getAsTextRange().orElse(null);

                if (isSingleLineData.getAsBoolean() && isNonZeroCharOffset.getAsBoolean()) {
                    final long startOffset = receivedSourceLocation.getDataRange().getCharOffsetFrom();

                    if (startOffset != 1) {
                        final int highlightDelta = (int) (highlight.getLocationFrom().getColNo() - startOffset);
                        editorHighlight = highlight.getAsTextRange()
                                .map(textRange ->
                                        textRange.withNewStartPosition(DefaultLocation.of(1, highlightDelta)))
                                .orElse(null);
                    }
                }
                textRanges.add(editorHighlight);
            }
            textPresenter.setHighlights(textRanges);
        } else {
            textPresenter.setHighlights(null);
        }
    }
Compare the {@link DataRange}s using on the from/to {@link Location};
stroom-core-client/src/main/java/stroom/data/client/presenter/SourcePresenter.java