• Login
Community
  • Login

Place cursor in center of displayed text when Goto line number.

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
2 Posts 2 Posters 380 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 Apr 17, 2024, 1:44 PM

    Notepad++ v8.6.2 (64-bit)
    Build time : Jan 14 2024 - 02:16:00
    Admin mode : OFF
    Local Conf mode : ON
    Cloud Config : OFF
    OS Name : Windows 10 Pro (64-bit)
    OS Version : 22H2
    OS Build : 19045.4291
    Current ANSI codepage : 1252
    Plugins :
    AutoSave (1.6.1)
    mimeTools (3)
    NppConverter (4.5)
    NppExport (0.4)
    NppSnippets (1.6)

    (I think the forum did not like my Windows path info and said “You need at least 1 reputation to post links”. So I removed that info from the NPP debug info above.)

    When I hit ^G to go to a line in Notepad++, the cursor eithers goes to the top of the window, or bottom of the window, depending on which direction the cursor has to travel. Is there a way to put the cursor about 5 lines from the top of the NPP window when doing a Goto Line?

    Thank you.

    P 1 Reply Last reply Apr 17, 2024, 2:59 PM Reply Quote 1
    • P
      PeterJones @C Bacca
      last edited by Apr 17, 2024, 2:59 PM

      @C-Bacca said in Place cursor in center of displayed text when Goto line number.:

      Is there a way to put the cursor about 5 lines from the top of the NPP window when doing a Goto Line?

      Not natively.

      If you are going to a line near the top of the file, you could do Ctrl+Home then Goto Line. Or if you’re going to a line near the bottom, Ctrl+End before Goto Line. For one in the middle, you could Goto Line then use the mouse scrollwheel or Ctrl+Arrow to quickly scroll that line to the middle. (Settings > Preferences > Editing 1 > ☑ Enable scrolling beyond last line will help if you want to be able to center it with scrollwheel, even if you go to the last line.)

      If that’s not sufficient, it could be coded up in the PythonScript Plugin or similar scripting plugin, and then assign that script a keyboard shortcut to use – and you could then run that script instead of Goto Line. It’s not that difficult to do a “goto” then try to center it in PythonScript syntax; if you need help to do such a script, let us know (though we aren’t a code-writing service, so you’ll be expected to take an active role).

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