Just like the cursor clears its goal column when it is moved in any
way other than vertically, the selection clears its goal range (the
range it will attempt to use when adding a selection below) when it
is changed in any way.
Previously, if a selection was added and removed before the editor got
a chance to update its display, it would try to add a selection view
for the destroyed selection. Now we check the new selections and
cursors to make sure they aren't destroyed before we add views for
them.
This is more consistent with other range-oriented methods on
EditSession. At this layer, we need to be explicit about what kind
of range we are talking about.
This makes it easy to only assign variables for the information you
need in the iterator. Before, we always forced you to take a match and
a range as the first two arguments even if you weren't using them.
When assigning the cursor's position, if we decide we want to autoscroll,
we should do so even if the cursor's position doesn't change.
The previous approach relied on a comparison of the position being
assigned, but this is before it has been clipped. Now we rely on a
boolean return value from the marker position assignment methods, which
tells us if the position has changed. If not, we need to emit our own
event to force autoscrolling.
This is needed by the snippets package, which needs to know where the
cursor was previously when it moves to decide whether to cancel the
current snippet.
This is used by cursor to only autoscroll when the marker head is
explicitly moved, so that passive movements caused by buffer insertions
don't trigger autoscrolling.
This commit makes autoscroll a 3-valued property on the cursor. If it
is set to true or false, that setting will stick until the cursor's
next visual update. That means we can explicitly move the cursor with
autoscroll set to false, but also still autoscroll by default when the
cursor's anchor moves on its own.