On Wed, May 8, 2013 at 6:37 PM, Ashwin Hirschi <
ashwin....@gmail.com> wrote:
> Note that after the unfold-all the caret/text insertion point is still where
> it originally was. You just cannot see it. And pressing e.g. a cursor key
> will trigger Scite to snap the view back to what it should be.
I am not sure everyone will agree what the view *should* be.
Personally, I think the view should change state as little as possible
with a fold or unfold. For example, if I have a very long file that
has a lot of foldable sections, and I put the caret near the bottom,
and then fold all, my view stays near the bottom, which is what seems
natural to me. But it's natural because that is what I was viewing
before I did the fold, not because the caret is there.
If I leave the caret near the bottom of this long file which is
maximally folded, and I explicitly change the view without changing
the caret (maybe I use the scroll bar), so I'm now looking at the top
of the buffer, but the caret is still near the bottom; then when I
unfold all, what is most intuitive to me is for the view to remain
near the top, because that is where I have deliberately placed the
view.
So having the view jump back down to the bottom, just because the
caret is there, would probably be equally annoying to me. (I don't
really know; I practically never use folding.) If I had to guess on
an algorithm for positioning after unfold, I would say that whatever
line is the topmost visible line before the unfold should remain the
topmost visible line after the unfold.
John