Keep ViewPosition consistent when a Document is edited from different Views, and on buffer switching #10559
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Supersedes #7568, fixes #7355.
Since view offsets can no longer be initialised in
View::new()
, I moved them next to selection initialisation indoc.ensure_view_init(view_id)
. I was a little concerned about all those unwraps ondoc.view_data(view_id)
(those functions are infallible and don't have a mutable reference to doc, so there's no way to ensure view_data is initialised in there), but in theory it should be panic-safe, as long asdoc.ensure_view_init(view_id)
is called for every new view, which it is. It was missing from some test cases, since they didn't seem to need selections, but it's added even to those now.