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.
Just like the cursor tries to stay in its "goal column" when moving
vertically, here we try to keep the same selection even when adding
across shorter lines.
This required changing text-buffer to support having a
path but not underlying file that exists yet.
Now calling RootView.open() with a non-existed path will
open a dirty empty editor to the path and the file will be
created on first save.
Previously EditSession.backspaceToBeginningOfLine() would do nothing
if at the beginning of the line.
Now it selects left and does a delete so it can be used to delete
multiple lines continuously without having to move the cursor.
Refs #134
Previously, logic associated with swapping grammars was a bit
scattered. Now grammar reloading / assignment methods delegate to
LanguageMode directly, and it emits a 'grammar-changed' event when
the grammar changes. Now EditSession and TokenizedBuffer listen for
this event and perform necessary actions for grammar change.
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.
Since buffers are now serialized directly, previous versions of the
EditSession state which used the buffer's path as the `buffer` key
are no longer valid.
We might have two edit sessions pointing to the same buffer, for
example if we have a split pane… So when we deserialize a buffer, we
always need to check that we don't already have an instance of that
buffer on the project. If we do, then we've already deserialized it
once so we don't need to worry about the saved text.
We still have a problem when deserializing previously unsaved buffers,
because we can't use the path to identify them.
This was causing a spec to fail since the line text now had a leading
space for all results since the separator before the line text is now
': ' instead of just ':'.