helix
helix copied to clipboard
Keep ViewPosition consistent when a Document is edited from different Views, and on buffer switching
Supersedes #7568, fixes #7355.
Since view offsets can no longer be initialised in View::new()
, I moved them next to selection initialisation in doc.ensure_view_init(view_id)
. I was a little concerned about all those unwraps on doc.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 as doc.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.
Can we get a retry on this test failure? It looks unrelated to my changes, and I can't reproduce it.
Ran the same commit through CI on my fork and got a pass https://github.com/intarga/helix/actions/runs/8790787504?pr=1
Something must have changed on the Github Actions runner, I'm seeing the same failure in other PRs.
Looks like macos runners switched from x86 to arm. Clearing the tree-stter-grammars cache for macos seems to have fixed it
this lgtm now and was a smaller change than I expected. I will test this out locally a bit