private void recordDecoratedHighlight(final SourceLocation sourceLocation) {
        final DataRange receivedHighlight = sourceLocation != null
                ? sourceLocation.getFirstHighlight()
                : null;

        // When a request is first sent for TEXT data with a highlight, the highlight will
        // get decorated with the byte offsets of that highlight. Subsequent requests may have
        // the same highlight but the server may be unable to decorate it if it doesn't encounter the highlight.
        // Therefore, we mustn't overwrite the byte offsets we hold locally unless the line/col locations
        // have changed.
        if (currentTextHighlight == null
                || !currentTextHighlight.getOptByteOffsetFrom().isPresent()
                || !currentTextHighlight.getOptByteOffsetTo().isPresent()
                || !areSameLocations(currentTextHighlight, receivedHighlight)) {
            currentTextHighlight = receivedHighlight;
        }
    }
Will attempt to set the source range using the passed highlight, i.e. if the highlight
is towards the end of the data then it will set the range to enclose the highlight.
stroom-core-client/src/main/java/stroom/data/client/presenter/SourcePresenter.java