• Login
Community
  • Login

Click function, go to fctn put cursor near top of window

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
7 Posts 3 Posters 283 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C
    C Bacca
    last edited by Aug 27, 2024, 4:01 PM

    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!

    P 1 Reply Last reply Aug 27, 2024, 4:54 PM Reply Quote 0
    • P
      PeterJones @C Bacca
      last edited by Aug 27, 2024, 4:54 PM

      @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.)

      A C 2 Replies Last reply Aug 27, 2024, 5:38 PM Reply Quote 1
      • A
        Alan Kilborn @PeterJones
        last edited by Aug 27, 2024, 5:38 PM

        @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??

        P 1 Reply Last reply Aug 27, 2024, 5:41 PM Reply Quote 2
        • P
          PeterJones @Alan Kilborn
          last edited by Aug 27, 2024, 5:41 PM

          @Alan-Kilborn ,

          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)

          A 1 Reply Last reply Aug 27, 2024, 6:02 PM Reply Quote 1
          • C
            C Bacca @PeterJones
            last edited by Aug 27, 2024, 5:46 PM

            @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.

            1 Reply Last reply Reply Quote 0
            • A
              Alan Kilborn
              last edited by Alan Kilborn Aug 27, 2024, 6:04 PM Aug 27, 2024, 6:00 PM

              Here’s the code that does the centering for function list:

              https://github.com/notepad-plus-plus/notepad-plus-plus/blob/8e26e08c1cf799c632c3cdc067804ed128f6e743/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp#L592


              It was added in April of 2013 and first saw the light-of-day in v7.2.2:

              https://github.com/notepad-plus-plus/notepad-plus-plus/commit/06756d29581f2b78888e74e79449e4a38995e65e

              1 Reply Last reply Reply Quote 2
              • A
                Alan Kilborn @PeterJones
                last edited by Alan Kilborn Aug 27, 2024, 6:03 PM Aug 27, 2024, 6:02 PM

                @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.

                1 Reply Last reply Reply Quote 3
                7 out of 7
                • First post
                  7/7
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors