Click function, go to fctn put cursor near top of window
-
When I click a function name in the function list, NPP goes to the function but centers the function name vertically.
How do I go to the function with the function name 5 lines from the top from the NPP window?
I know I’ve done this in past version of NPP but I cannot find my notes on it.
Thanks!
-
@C-Bacca said in Click function, go to fctn put cursor near top of window:
I know I’ve done this in past version of NPP but I cannot find my notes on it.
Odd. There’s never been an option to control it, and I cannot ever remember seeing it default to exactly 5 lines from the top. Do you know what your “past version of NPP” was?
The Settings > Preferences > Editing 1 > ☐ Enable scrolling beyond last line will affect the behavior (because functions near the end won’t fully center, but stay closer to the bottom, if it cannot scroll beyond the end), but I don’t know of any way to force it to be always 5 lines (or always N lines) from the top.
@Alan-Kilborn, would your caretpolicy feature request be able to help with this? I guess it depends on which command Notepad++ sends to the Scintilla component when it tries to go to the selected function. (I haven’t played with that feature of Scintilla, so I’m not sure if the FunctionList centering would use it or not.)
-
@PeterJones said in Click function, go to fctn put cursor near top of window:
would your caretpolicy feature request be able to help with this?
It could help, I think, if the centering effect from function list double clicking (note that OP should have said “double-click”, not “click” – single click on a function name in the function list does nothing for source navigation) were removed.
IMO it makes good sense for the function definition line to be made the first line of the viewport after double-clicking. What good does it really do to center it? (I know OP isn’t asking for that, but to me it makes more sense than “5 lines from the top” – of course maybe the OP has a 5 line comment block at the top of every function in their files…). Regardless, centering seems a waste, because why do I want to see the bottom bunch of lines from the previous function in my viewport??
-
In your opinion, should @C-Bacca just upvote your “caretpolicy” request, or should a new Feature Request be entered that doesn’t say anything specifically about “caretpolicy” and instead just ask for the desired end result (wanting to be able to start the FunctionList destination scroll at line 5 or line 1, maybe user-configurable)
-
@PeterJones I’ve been using NPP for at least 8 years and I remember it was an INI file setting, but I don’t know which setting. I don’t recall which version of NPP did this either. But I could not set it in the GUI, I had to edit an INI file.
It might have been related to the Goto Line editor function as well.
-
Here’s the code that does the centering for function list:
It was added in April of 2013 and first saw the light-of-day in v7.2.2:
-
@PeterJones said in Click function, go to fctn put cursor near top of window:
In your opinion, should @C-Bacca just upvote your “caretpolicy” request, or should a new Feature Request
I would make this a new feature request, but anybody that would take on implementation might have a look at the caret-policy issue and see if 2-birds-1-stone could be effective.