Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You could just set mark when scrolling starts. Then, next cursor move jump back to mark first.

Some heuristics to make it fully behave. Multiple scroll events should not modify mark, for example. Mouse click does not jump back to mark. Etc.



The lack of "scroll-preserve-buffer-position" has been a very minor pet peeve for me for multiple years, and for some reason this very simple solution just never occurred to me.

I can't believe I didn't think of this. I'm already using marks to keep track of position when I scroll, it's just all manual right now.

I'll likely mess around with some hooks in my config this weekend and see if this is actually feasible, or if it comes with caveats I'm not seeing right now. I guess it would need to account for multiple windows open into the same buffer too.


I'm convinced the edge cases will dominate this code, but the general idea seems straight forward. If you get this working, please share. Not something I think I want, per se, but I could be mistaken on seeing it work. :)


Well done. You have confirmed what they said:

> and the solution was something like "you are using it wrong - you need to use marks instead".


My point was you could automate it. You were not using it wrong. Instead, my point is that you can make using it act like you want.


Agreed, was thinking the same.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: