make Caret.getOffset() work correctly from a side thread (under read action)