// invert selection to avoid jumping to the end of the selection in st.showSelection()
viewer.setSelectedRange(offset + length, -length);
//viewer.revealRange(offset, length); // will trigger jumping
StyledText st = viewer.getTextWidget();
if (st != null)
st.showSelection(); // only minimal scrolling
}
private IRegion getRegion(IDocument document, ILineRange lineRange) throws BadLocationException {
final int startLine = lineRange.getStartLine();
int offset = document.getLineOffset(startLine);