inlined setVisualSelection, trying to fix issue #1