Avoid scrolling to cursor position in a non-visible editor

Simple fix for #1236.