<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I have the following situation: I bookmark a line with CTRL+F2 then scroll down to some other text in the document. After some time I jump back to the bookmark using SHIFT+F2 and the bookmarked line appears in the <em>middle</em> of the screen. However, I would like it to appear at the top.<br />
Is it possible to avoid the default behaviour and show the bookmarked line at the top of the window, i.e. the first visible line after jumping to the bookmark is the bookmarked line itself .</p>
<p dir="auto">Just for better understanding a more concrete example:<br />
I am writing a function in,  let’s say C++ and bookmark the function head for later reference.<br />
As I add more text to the document, I want to jump back to the function and be able to see as much as possible from the function’s body.<br />
When the bookmarked line is showed in the middle of my screen however, I first have to scroll down a bit using the mouse or the arrow keys.<br />
Since this is a quite common situation for me, it would really be a timesaver to have the bookmarked line alway at the top of the window when jumping to it.</p>
<p dir="auto">Thanks for helping me out.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/20370/how-to-jump-to-a-bookmark-and-show-the-bookmarked-line-at-the-top-of-the-screen-not-in-the-middle</link><generator>RSS for Node</generator><lastBuildDate>Sun, 16 Aug 2026 01:09:36 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/20370.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 22 Nov 2020 23:03:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Thu, 05 Jun 2025 14:41:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/hashir-maher" aria-label="Profile: Hashir-Maher">@<bdi>Hashir-Maher</bdi></a> ,</p>
<p dir="auto">I didn’t understand it two years ago when <a class="plugin-mentions-user plugin-mentions-a" href="/user/sky-247" aria-label="Profile: sky-247">@<bdi>sky-247</bdi></a> suggested it, and I still don’t understand it now that you reply saying it was a good idea: how does changing font size or zoom level change whether the “jump to next/prev bookmark” takes you to the middle or the top of the screen?</p>
<p dir="auto">I mean, I can understand that when zoomed fully in, that there are so few lines that the “middle” and the “top” are close to each other.<br />
<img src="/assets/uploads/files/1749133792412-2280b82f-16c2-477a-85f2-c24580232355-image.png" alt="2280b82f-16c2-477a-85f2-c24580232355-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">But when you zoom back to normal, it’s still a few lines from the top, rather being <em>at</em> the top, like was requested.  And I don’t see how you can make “jumping to bookmarks feel a lot smoother” using zooming in.</p>
<p dir="auto">And if you zoom <em>out</em>, it’s the exact opposite of what the original poster requested in 2020, in that the middle, where it jumps to, is even <em>farther</em> from being at the top of the screen.  I mean, if it’s a short enough file, then <em>all</em> the bookmarks will be “near” the top, but it will be unreadable:<br />
<img src="/assets/uploads/files/1749133997952-13efed98-64fb-412b-bd31-abc1a3fc8074-image.png" alt="13efed98-64fb-412b-bd31-abc1a3fc8074-image.png" class=" img-fluid img-markdown" /><br />
, and when you return to normal zoom, the window might not be anywhere near the bookmark you just jumped to, so it makes the zoom-out version even more useless than the zoom-in version.</p>
<p dir="auto">Can you explain why you think that <a class="plugin-mentions-user plugin-mentions-a" href="/user/sky-247" aria-label="Profile: sky-247">@<bdi>sky-247</bdi></a>’s suggestion is at all helpful for the original question of how to show the jumped line at the top of the screen?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/101960</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/101960</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 05 Jun 2025 14:41:26 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Thu, 05 Jun 2025 11:48:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sky-247" aria-label="Profile: sky-247">@<bdi>sky-247</bdi></a> said in <a href="/post/84102">How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle</a>:</p>
<blockquote>
<p dir="auto">One option could be to temporarily change the font size or zoom level of the document so that the bookmarked line fits at the top of the screen when you jump to it. You can do this by using the zoom in/out feature or changing the font size. After you have finished reviewing the bookmarked line, you can return the font size or zoom level back to its original setting.</p>
</blockquote>
<p dir="auto">That’s a clever workaround! Adjusting zoom or font size to control line positioning isn’t something I thought of, but it makes jumping to bookmarks feel a lot smoother. Thanks for the tip!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/101957</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/101957</guid><dc:creator><![CDATA[Hashir Maher]]></dc:creator><pubDate>Thu, 05 Jun 2025 11:48:07 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Mon, 13 Feb 2023 09:32:55 GMT]]></title><description><![CDATA[<p dir="auto">One option could be to temporarily change the font size or zoom level of the document so that the bookmarked line fits at the top of the screen when you jump to it. You can do this by using the zoom in/out feature or changing the font size. After you have finished reviewing the bookmarked line, you can return the font size or zoom level back to its original setting.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84102</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84102</guid><dc:creator><![CDATA[sky 247]]></dc:creator><pubDate>Mon, 13 Feb 2023 09:32:55 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Tue, 22 Nov 2022 12:51:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jaguar-asad" aria-label="Profile: Jaguar-Asad">@<bdi>Jaguar-Asad</bdi></a> said in <a href="/post/81840">How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle</a>:</p>
<p dir="auto">I think your posting got screwed up, but this is what you meant to add to this thread:</p>
<p dir="auto"><em><strong>I have followed all the instructions over there but all in vain. Considering myself dmbest</strong></em></p>
<p dir="auto">I guess you’ll have to be more specific about what is giving you trouble, in order for someone to assist.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/81841</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/81841</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 22 Nov 2022 12:51:20 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Tue, 22 Nov 2022 12:43:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a> said in <a href="/post/60083">How to jump to a </a><a href="https://customcraftltd.com/custom-wooden-boxes/" rel="nofollow ugc">bookmark</a><a href="/post/60113"> and show the bookmarked line at the top of the screen, not in the middle</a>:</p>
<blockquote>
<blockquote>
<p dir="auto">is it possible to have 2 shortcuts (ex Shift-F2 and F2, as they ARE the prev and next bookmark options) BOTH mapped to a new script, and then that script can read what invoked it (so able to read which shortcut was used), then act accordingly?</p>
</blockquote>
<p dir="auto">PythonScripts don’t have any information about what keys invoked them, AFAIK.<br />
A single script can only be tied to a single shortcut.<br />
So, you’d have to have 2 scripts for what you describe.<br />
Of course, each could call a third script with a bunch of common stuff (the “meat”) in it, the first 2 scripts being very short and just passing in arguments to the third to tell it what to do, but that would be THREE when you wanted ONE!<br />
I have followed all the instructions over there but all in vain. Considering myself dmbest</p>
</blockquote>
]]></description><link>https://community.notepad-plus-plus.org/post/81840</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/81840</guid><dc:creator><![CDATA[Jaguar Asad]]></dc:creator><pubDate>Tue, 22 Nov 2022 12:43:43 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Wed, 25 Nov 2020 12:49:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/astrosofista" aria-label="Profile: astrosofista">@<bdi>astrosofista</bdi></a> said</p>
<blockquote>
<p dir="auto">14</p>
</blockquote>
<p dir="auto">A limitation of that approach (OP had previously said “it does happen that I resize the window on different screens”), but interesting.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60143</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60143</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 25 Nov 2020 12:49:56 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Wed, 25 Nov 2020 03:16:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a> said in <a href="/post/60113">How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle</a>:</p>
<blockquote>
<p dir="auto">So one final question (possibly), is it possible to have 2 shortcuts (ex Shift-F2 and F2, as they ARE the prev and next bookmark options) BOTH mapped to a new script, and then that script can read what invoked it (so able to read which shortcut was used), then act accordingly?</p>
</blockquote>
<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a>, All:</p>
<p dir="auto">AutoHotkey is quite good for what you asked. This short script doesn’t actually deal with the internals of Notepad++, just plays with the user interface.</p>
<pre><code class="language-z">#IfWinActive ahk_class Notepad++
~F2::
~+F2::
Term := SubStr(A_ThisHotkey,2,1)
if (Term = "+") {
	SendInput, ^{Up 14}
} else {
	SendInput, ^{Down 14}
}
return
#IfWinActive
</code></pre>
<p dir="auto">Press <code>F2</code> to place the next bookmarked line at the top of the screen, press <code>Shift+F2</code> to place the previous bookmarked line at the bottom of the screen. In my current set up <code>14</code> is the number of lines to send up or down, but you may need to adjust it to your needs.</p>
<p dir="auto">The tilde <code>~</code> lets the hotkey sequence get through. If you ever want to use the standard behaviour of the bookmark command —place the bookmarked line at the middle of the screen—, just select the <code>Next</code> or <code>Previuos Bookmark</code> commands from the <code>Search</code> menu.</p>
<p dir="auto">Finally, the <code>#IfWinActive</code> directive ensures that the hotkeys will not interfere with applications other than Notepad++, that is, they won’t work system wide.</p>
<p dir="auto">Have fun!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60141</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60141</guid><dc:creator><![CDATA[astrosofista]]></dc:creator><pubDate>Wed, 25 Nov 2020 03:16:45 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Mon, 23 Nov 2020 21:46:07 GMT]]></title><description><![CDATA[<p dir="auto">All good ideas and thinking, Terry!<br />
Your future scripts will be as good as your regexes. :-)</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a> said in <a href="/post/60113">How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle</a>:</p>
<blockquote>
<p dir="auto">is it possible to have 2 shortcuts (ex Shift-F2 and F2, as they ARE the prev and next bookmark options) BOTH mapped to a new script, and then that script can read what invoked it (so able to read which shortcut was used), then act accordingly?</p>
</blockquote>
<p dir="auto">PythonScripts don’t have any information about what keys invoked them, AFAIK.<br />
A single script can only be tied to a single shortcut.<br />
So, you’d have to have 2 scripts for what you describe.<br />
Of course, each could call a third script with a bunch of common stuff (the “meat”) in it, the first 2 scripts being very short and just passing in arguments to the third to tell it what to do, but that would be THREE when you wanted ONE!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60114</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60114</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 23 Nov 2020 21:46:07 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Mon, 23 Nov 2020 21:38:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said in <a href="/post/60111">How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle</a>:</p>
<blockquote>
<p dir="auto">I’d go simpler, like the days when .ini files ruled the day. :-)</p>
</blockquote>
<p dir="auto">So one final question (possibly), is it possible to have 2 shortcuts (ex Shift-F2 and F2, as they ARE the prev and next bookmark options) BOTH mapped to a new script, and then that script can read what invoked it (so able to read which shortcut was used), then act accordingly?</p>
<p dir="auto">Just a thought as that would save the interaction window with user. The top or bottom option would be set as unlikely user would want to continually change that. Maybe the script would ask first time invoked each session which option top/bottom and write that away (to your .ini file).</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60113</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60113</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Mon, 23 Nov 2020 21:38:29 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Mon, 23 Nov 2020 21:38:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a> said in <a href="/post/60107">How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle</a>:</p>
<blockquote>
<p dir="auto">I’m currently going through a course on Python (just started) as I was interested in some of the workings behind NPP (Scintilla functions) but maybe I need to reconsider and look at NppExec. Where does one learn NppExec?</p>
</blockquote>
<p dir="auto">NppExec is fine, but I would definitely stay the course with the Python!<br />
More of an investment, but a lot of payoff.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60112</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60112</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 23 Nov 2020 21:38:37 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Mon, 23 Nov 2020 21:32:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a> said in <a href="/post/60110">How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle</a>:</p>
<blockquote>
<p dir="auto">these settings can be saved across successive runs of the script?</p>
</blockquote>
<p dir="auto">A Python “global” variable can hold the value.  Two different scripts can access.  Or, the config script could write a disk file and the main script could read it (getting to the stuff <em>below</em>).</p>
<blockquote>
<p dir="auto">I don’t suppose it’s possible to save these within one of NPP’s XML files so in fact the config is saved across consecutive runs of NPP?</p>
</blockquote>
<p dir="auto">No.<br />
Or at least: “I wouldn’t do that”</p>
<blockquote>
<p dir="auto">Or would one just create a new XML file with the settings that ONLY that script looks for?</p>
</blockquote>
<p dir="auto">It’s so simple, I wouldn’t bother with XML.<br />
I’d go simpler, like the days when <code>.ini</code> files ruled the day. :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60111</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60111</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 23 Nov 2020 21:32:05 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Mon, 23 Nov 2020 21:27:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said in <a href="/post/60109">How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle</a>:</p>
<blockquote>
<p dir="auto">r maybe there’s a second script to configure it, and the main script uses the configuration?</p>
</blockquote>
<p dir="auto">Yes I was also thinking along those lines. Not knowing how that’s possible I could only assume each time the next/prev bookmark wanted the options would have to be presented. So I take it that within a “session” of NPP these settings can be saved across successive runs of the script?</p>
<p dir="auto">I don’t suppose it’s possible to save these within one of NPP’s XML files so in fact the config is saved across consecutive runs of NPP? Or would one just create a new XML file with the settings that ONLY that script looks for?</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60110</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60110</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Mon, 23 Nov 2020 21:27:42 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Mon, 23 Nov 2020 21:23:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a> said in <a href="/post/60107">How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle</a>:</p>
<blockquote>
<p dir="auto">a solution for a choice of forward or backwards and bookmarked line at top or at bottom</p>
</blockquote>
<p dir="auto">So the problem here is that nobody would want to answer such questions each time they want to jump to a bookmark. :-)</p>
<p dir="auto">So it becomes a “configuration” issue, that you’d answer once, perhaps the first time you run the script in a N++ session?</p>
<p dir="auto">Or maybe there’s a second script to configure it, and the main script uses the configuration?  To change the configuration mid-session, you’d run the config script again.</p>
<p dir="auto">Lots of things are possible…  :-)</p>
<p dir="auto">Config with Pythonscript could be two message-boxes based questions:</p>
<p dir="auto"><img src="https://i.imgur.com/k8jwGN6.png" alt="Imgur" class=" img-fluid img-markdown" /></p>
<p dir="auto">and</p>
<p dir="auto"><img src="https://i.imgur.com/Qwa4EsS.png" alt="Imgur" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/60109</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60109</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 23 Nov 2020 21:23:43 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Mon, 23 Nov 2020 21:14:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a> said in <a href="/post/60107">How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle</a>:</p>
<blockquote>
<p dir="auto">actually the OP stated Shift-F2 which is previous bookmark</p>
</blockquote>
<p dir="auto">Ah, okay, so that is why <a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a> did what he did, and makes my typing of:</p>
<blockquote>
<p dir="auto">I think your IDM_SEARCH_PREV_BOOKMARK should really be IDM_SEARCH_NEXT_BOOKMARK, i.e., just a typo?</p>
</blockquote>
<p dir="auto">nicely invalid.<br />
:-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60108</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60108</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 23 Nov 2020 21:14:46 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Mon, 23 Nov 2020 21:07:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said in <a href="/post/60104">How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle</a>:</p>
<blockquote>
<p dir="auto">I’ll offer up this script, which can do either behavior</p>
</blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a> also, actually the OP stated <code>Shift-F2</code> which is previous bookmark. I see through all the iterations of solutions that seems to have changed to <code>next</code> bookmark.</p>
<p dir="auto">Maybe someone might want to offer up a solution for a choice of forward or backwards and bookmarked line at top or at bottom. So in effect 4 options. How can this be achieved within the 1 solution. Is it possible to have NppExec do a quick question on screen before enacting the request. So asking whether next or previous and top or bottom.</p>
<p dir="auto">I’m currently going through a course on Python (just started) as I was interested in some of the workings behind NPP (Scintilla functions) but maybe I need to reconsider and look at NppExec. Where does one <code>learn</code> NppExec?</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60107</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60107</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Mon, 23 Nov 2020 21:07:21 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Mon, 23 Nov 2020 20:27:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a> said in <a href="/post/60103">How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle</a>:</p>
<blockquote>
<p dir="auto">SCI_LINESONSCREEN</p>
</blockquote>
<p dir="auto">In light of that info, thanks <a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a> , I’ll offer up this script, which can do either behavior, by a simple change (of one character) from <code>1</code> to <code>0</code> (your choice!) in the first line:</p>
<pre><code class="language-z">from Npp import editor, notepad, MENUCOMMAND
align_bookmark_to_bottom_of_window_not_top = True if 1 else False
editor.homeDisplay()
notepad.menuCommand(MENUCOMMAND.SEARCH_NEXT_BOOKMARK)
line_of_bookmark = editor.lineFromPosition(editor.getCurrentPos())
lines_on_screen = editor.linesOnScreen() if align_bookmark_to_bottom_of_window_not_top else 1
editor.setFirstVisibleLine(line_of_bookmark - lines_on_screen + 1)
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/60104</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60104</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 23 Nov 2020 20:27:07 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Mon, 23 Nov 2020 20:12:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said in <a href="/post/60102">How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle</a>:</p>
<blockquote>
<p dir="auto">I’m curious, though, how one might adapt these solutions to put the bookmarked line at the very bottom of the user’s display window.</p>
</blockquote>
<pre><code>SCI_SENDMSG SCI_GETFIRSTVISIBLELINE
SET LOCAL FIRST = $(MSG_RESULT)

SCI_SENDMSG SCI_LINESONSCREEN
SET LOCAL LINES = $(MSG_RESULT)

SET LOCAL LINE ~ $(FIRST) + $(LINES)
SCI_SENDMSG SCI_GOTOLINE $(LINE)
</code></pre>
<p dir="auto"><a href="https://www.scintilla.org/ScintillaDoc.html#SCI_LINESONSCREEN" rel="nofollow ugc"><code>SCI_LINESONSCREEN</code></a></p>
<p dir="auto">Cheers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60103</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60103</guid><dc:creator><![CDATA[Michael Vincent]]></dc:creator><pubDate>Mon, 23 Nov 2020 20:12:33 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Mon, 23 Nov 2020 20:01:44 GMT]]></title><description><![CDATA[<p dir="auto">I’m curious, though, how one might adapt these solutions to put the bookmarked line at the very bottom of the user’s display window.</p>
<p dir="auto">I didn’t see the obvious solution to this one, in the available Scintilla functions as there is no “SCI_SETLASTVISIBLELINE”.</p>
<p dir="auto">I thought maybe <a href="https://www.scintilla.org/ScintillaDoc.html#SCI_GETLINEVISIBLE" rel="nofollow ugc">SCI_GETLINEVISIBLE</a> would help, but no, it returns “true” for lines that are not currently on-screen (as long as those lines aren’t part of a “fold”, or “hidden” lines).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60102</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60102</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 23 Nov 2020 20:01:44 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Mon, 23 Nov 2020 19:51:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a></p>
<blockquote>
<p dir="auto">npp_sendmsg WM_COMMAND IDM_SEARCH_PREV_BOOKMARK</p>
</blockquote>
<p dir="auto">I think your <code>IDM_SEARCH_PREV_BOOKMARK</code> should really be <code>IDM_SEARCH_NEXT_BOOKMARK</code>, i.e., just a typo?</p>
<p dir="auto">Anyway, for another take on that specific solution, here’s a PythonScript equivalent:</p>
<pre><code class="language-z">from Npp import editor, notepad, MENUCOMMAND
editor.homeDisplay()
notepad.menuCommand(MENUCOMMAND.SEARCH_NEXT_BOOKMARK)
curr_pos = editor.getCurrentPos()
curr_line = editor.lineFromPosition(curr_pos)
editor.setFirstVisibleLine(curr_line)
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/60101</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60101</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 23 Nov 2020 19:51:48 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Mon, 23 Nov 2020 11:32:07 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for all your suggestions so far!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60088</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60088</guid><dc:creator><![CDATA[Sebastian Freeh]]></dc:creator><pubDate>Mon, 23 Nov 2020 11:32:07 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Mon, 23 Nov 2020 10:59:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sebastian-freeh" aria-label="Profile: Sebastian-Freeh">@<bdi>Sebastian-Freeh</bdi></a></p>
<p dir="auto">Another <em>NppExec</em> variant without using loops:</p>
<pre><code>npp_console keep

sci_sendmsg SCI_HOMEDISPLAY
npp_sendmsg WM_COMMAND IDM_SEARCH_PREV_BOOKMARK

sci_sendmsg SCI_GETCURRENTPOS
sci_sendmsg SCI_LINEFROMPOSITION $(MSG_RESULT)
sci_sendmsg SCI_SETFIRSTVISIBLELINE $(MSG_RESULT)
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/60087</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60087</guid><dc:creator><![CDATA[dinkumoil]]></dc:creator><pubDate>Mon, 23 Nov 2020 10:59:58 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Mon, 23 Nov 2020 01:45:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sebastian-freeh" aria-label="Profile: Sebastian-Freeh">@<bdi>Sebastian-Freeh</bdi></a><br />
<a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a> said in <a href="/post/60081">How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle</a>:</p>
<blockquote>
<p dir="auto">PythonScript is one method of linking to those functions. There are lots of references made to these in other posts here, which you can search on.</p>
</blockquote>
<p dir="auto">One other such language is <a href="https://github.com/d0vgan/nppexec" rel="nofollow ugc">NppExec</a> and the simplest form would be:</p>
<pre><code>SCI_SENDMSG SCI_GETCURRENTPOS
SET LOCAL POS = $(MSG_RESULT)
SET LOCAL MASK ~ 1&lt;&lt;24

:LISTNEXT
SCI_SENDMSG SCI_MARKERNEXT $(POS) $(MASK)
SET LOCAL $(LINE) = $(MSG_RESULT)
IF $(LINE)==-1 THEN
    SET LOCAL POS = 0
    GOTO LISTNEXT
ENDIF
IF $(LINE)==$(POS) THEN
    SET LOCAL POS ~ $(POS) + 1
    GOTO LISTNEXT
ENDIF

SCI_SENDMSG SCI_SETFIRSTVISIBLELINE $(LINE)
SCI_SENDMSG SCI_GOTOLINE $(LINE)

:END
</code></pre>
<p dir="auto">You’d associate that script with some shortcut key and basically it finds your current position and sets the marker to find as the Notepad++ bookmark (24, bit-shifted to form the proper mask) and then finds the next mark from your current position.  If the return value is -1, there is no next mark so start at the top of the document and search again.  If the next mark is the same line you’re on, then go to the next line and search again.</p>
<p dir="auto">Note you could make the script more robust by using <a href="https://www.scintilla.org/ScintillaDoc.html#SCI_MARKERPREVIOUS" rel="nofollow ugc"><code>SCI_MARKERPREVIOUS</code></a> and some logic to search both up and / or down direction with wrap-around.</p>
<p dir="auto">The <a href="https://www.scintilla.org/ScintillaDoc.html#Markers" rel="nofollow ugc">Scintilla docs for marker searching</a> (again, 24 is the Notepad++ bookmark and you need to bit shift it to get the mask value they speak of).</p>
<p dir="auto">Cheers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60083</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60083</guid><dc:creator><![CDATA[Michael Vincent]]></dc:creator><pubDate>Mon, 23 Nov 2020 01:45:56 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Mon, 23 Nov 2020 00:24:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sebastian-freeh" aria-label="Profile: Sebastian-Freeh">@<bdi>Sebastian-Freeh</bdi></a> said in <a href="/post/60079">How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle</a>:</p>
<blockquote>
<p dir="auto">I think I haven’t changed anything</p>
</blockquote>
<p dir="auto">My fault. I initially thought you’d changed the shortcuts I referred to in the image of “my” shortcuts. But actually you were just using a different shortcut. If you look in the shortcut mapper for the items I was referring to you should see the keys I used will likely be what you have also.</p>
<p dir="auto">Well at least you have 2 ideas that should work reasonably well. It’s a bit of a leap to get on the Python train. Considering you are already programming though, it might not be too much of a job to learn “yet” another language.</p>
<p dir="auto">Just as a bit of a background, NPP is built on top of a couple of other products out there, “Boost C++ libraries” and “Scintilla”. You can read more about these (links are under the FAQ section) elsewhere. Boost has the “regular expression” language (if you wish to call it that) that NPP uses, and Scintilla is the editor. Scintilla has lots of functions, more than NPP presents and it may be possible one of those could do EXACTLY what you want. PythonScript is one method of linking to those functions. There are lots of references made to these in other posts here, which you can search on.</p>
<p dir="auto">Terry</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60081</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60081</guid><dc:creator><![CDATA[Terry R]]></dc:creator><pubDate>Mon, 23 Nov 2020 00:24:24 GMT</pubDate></item><item><title><![CDATA[Reply to How to jump to a bookmark and show the bookmarked line at the top of the screen, not in the middle on Mon, 23 Nov 2020 00:12:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry-r" aria-label="Profile: Terry-R">@<bdi>Terry-R</bdi></a> Nice idea! Just tried it out and works pretty well actually. Could be helpful in some situations. I’ll probably go for the macro, though.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/60080</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/60080</guid><dc:creator><![CDATA[Sebastian Freeh]]></dc:creator><pubDate>Mon, 23 Nov 2020 00:12:22 GMT</pubDate></item></channel></rss>