helix icon indicating copy to clipboard operation
helix copied to clipboard

Keep ViewPosition consistent when a Document is edited from different Views, and on buffer switching

Open intarga opened this issue 4 months ago • 5 comments

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.

intarga avatar Apr 22 '24 20:04 intarga

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

intarga avatar Apr 22 '24 20:04 intarga

Something must have changed on the Github Actions runner, I'm seeing the same failure in other PRs.

archseer avatar Apr 23 '24 02:04 archseer

Looks like macos runners switched from x86 to arm. Clearing the tree-stter-grammars cache for macos seems to have fixed it

the-mikedavis avatar Apr 23 '24 13:04 the-mikedavis

this lgtm now and was a smaller change than I expected. I will test this out locally a bit

pascalkuthe avatar Apr 28 '24 16:04 pascalkuthe