You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the plugin calls view.replace on the entire buffer contents and then restores the scroll position. This preserves the scroll position, but not the cursor position.
There's a different method we can borrow from DisposaBoy/GoSublime: diff the two buffers, and call view.replace only on the changed regions on the view. This tends to preserve both the scroll and the cursor position. I've tested this in mitranim/sublime-rust-fmt and mitranim/sublime-gofmt (my simplified alternative to this plugin), and it seems to work well. Performance seems fine; I tested this on a 5k LoC file and couldn't feel the difference.
Both of my plugins provide this as an option. If this method causes issues for some users, they can opt out. Anyway if you like the idea, I can make a PR.
The text was updated successfully, but these errors were encountered:
Currently the plugin calls
view.replace
on the entire buffer contents and then restores the scroll position. This preserves the scroll position, but not the cursor position.There's a different method we can borrow from DisposaBoy/GoSublime: diff the two buffers, and call
view.replace
only on the changed regions on the view. This tends to preserve both the scroll and the cursor position. I've tested this in mitranim/sublime-rust-fmt and mitranim/sublime-gofmt (my simplified alternative to this plugin), and it seems to work well. Performance seems fine; I tested this on a 5k LoC file and couldn't feel the difference.Both of my plugins provide this as an option. If this method causes issues for some users, they can opt out. Anyway if you like the idea, I can make a PR.
The text was updated successfully, but these errors were encountered: