https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40949 ?
The request/suggestion is: bring the caret into the visible text window instead of jumping back to where the caret is.
A possible variation of this request is to keep the caret's window-relative position constant, i.e, if the caret is in the middle of the visible window then scrolling using the mousewheel keeps the caret in the same place while the text moves to reflect the mouse scrolling (I believe this is the ideal choice as it leaves nothing out of view at anytime.) Effectively, mousewheel scrolling changes the line where the caret is but does not change its position in the source code window.
That leaves a lot of interpretations, with side-effects
"bring the caret into the visible"
=> Even if it was outside?
=> And where in the visible exactly (top/bottom border, keeping the caret-X if possible?)
"window-relative position", that is better defined, but
=> if the caret is outside the visible (e.g. one line above the top-visible), should it be kept at relative Y=
-1 ?
Then there is the option you did not mention:
Keep the caret under the mouse cursor (assuming the mouse is over the text area / otherwise as close as possible at the border, but do not trigger scrolling, i.e. horiz scrolling)
=> Of course:
if the editor is scrolled to the right, and you vertically wheel scroll over the left gutter, then the caret wants to go to the scrolled-out X that is under the gutter.
Should it: Stick to the visible left most? OR Go to the desired X, but do not scroll (therefore leave the visible area)?
There is a set of advanced option that do something almost like it.
Well, its 2 options, that were not meant to go together.
In advanced mouse, find the wheel scroll (normal / without ctrl-keys).
You need to find both: up / down
Edit them, and select "Move Caret"
The caret will almost stay under the mouse.
It gets the order wrong, it move to the mouse pos, but before the scroll. So it ends up one scroll away from the mouse. (Can be several lines).