focus-editor / focus

A simple and fast text editor
GNU General Public License v3.0
1.82k stars 99 forks source link

fix sudden scroll to end of file when switching panels #388

Closed Sanian-Creations closed 4 months ago

Sanian-Creations commented 4 months ago

Fixes #223

Moved two ifs down so that they perform their check on an updated version of viewport.top (which happens in the if on line 808, now 796), rather than the value from the previous frame.

Alternatively, it is possible to move the if on line 808 up to line 738 to update viewport.top sooner. That's is less code changes, but also has a bigger likelihood of changing the behaviour of other code in the file, though I've not noticed anything weird either way.

focus-editor commented 4 months ago

This code can be fragile but I'll test it and if I don't notice anything right away we can merge and keep an eye on it