<?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[Is there a way to get the current line number into the copy/paste buffer?]]></title><description><![CDATA[<p dir="auto">With Microsoft notepad I can go to a line, press ctrl-G which brings up the Go To Line dialog box, and the current line number is both the default value and is sitting in the input field to select which line to go to. It’s easy enough to then load the line number into the copy/paste buffer.</p>
<p dir="auto">With Notepad++ ctrl-G brings up the Go To… dialog box which shows</p>
<pre><code>You are here: (current number)
You want to go to: [blank input box]
</code></pre>
<p dir="auto">There’s no way to load the current line number into the copy/paste buffer.</p>
<p dir="auto">While editing I tried right clicking on the left margin where the line numbers are and looked through TextFX menu offerings but don’t see a way to get the current line number.</p>
<p dir="auto">I’m running<br />
Notepad++ v7.9   (32-bit)<br />
Build time : Sep 22 2020 - 03:24:22<br />
Path : C:\Program Files (x86)\Notepad++\notepad++.exe<br />
Admin mode : OFF<br />
Local Conf mode : OFF<br />
OS Name : Windows 10 Home (64-bit)<br />
OS Version : 1909<br />
OS Build : 18363.1139<br />
Current ANSI codepage : 1252<br />
Plugins : DSpellCheck.dll HexEditor.dll mimeTools.dll NppConverter.dll NppExport.dll NppTextFX.dll PythonScript.dll</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/20224/is-there-a-way-to-get-the-current-line-number-into-the-copy-paste-buffer</link><generator>RSS for Node</generator><lastBuildDate>Tue, 06 Oct 2026 19:06:55 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/20224.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 26 Oct 2020 18:12:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Is there a way to get the current line number into the copy/paste buffer? on Mon, 26 Oct 2020 23:16:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</bdi></a></p>
<blockquote>
<p dir="auto">Changing the offsets for the Go To dialog box so that they start at 1…</p>
</blockquote>
<p dir="auto">Actually, “offset” (being zero-based) makes perfect sense.<br />
If it were strictly “position” maybe it would make less sense, as that seems to more imply one-based.<br />
Although, in Scintilla-speak, SCI_GETCURRENTPOS returns a 0 if the caret is at beginning-of-file.</p>
<p dir="auto">I think I saw that a change is coming to Notepad++ where “position” is going to be displayed on the status bar.  I can’t remember if it is zero-based or one-based.</p>
<blockquote>
<p dir="auto">That change would break scripts that invoke the Go To box and use offset mode.</p>
</blockquote>
<p dir="auto">I don’t think there are any such scripts as the Go To box isn’t scriptable?</p>
<blockquote>
<p dir="auto">-p on the command line likely should remain zero based.</p>
</blockquote>
<p dir="auto">It seems like Notepad++ should get its act together and be internally consistent, be either 0-based or 1-based when dealing with “position”, no matter what existing functionality it might break.  :-)</p>
<p dir="auto">I just noticed in a UTF-8 document, if I put my caret just before a Unicode character that encodes into 4 bytes, I get an <code>editor.getCurrentPos()</code> return of <em>N</em> and if I move it just after that character and repeat that Pythonscript command, I get <em>N+4</em>.  This seems wrong to me; I should get <em>N+1</em>…  I guess it is one more thing that needs “evaluation” in Notepad++.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/59115</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59115</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 26 Oct 2020 23:16:57 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to get the current line number into the copy/paste buffer? on Mon, 26 Oct 2020 21:45:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> I don’t think there’s an easy wording fix for the lines vs offset thing. Any choice of words seems likely to be confusing to someone in the community of npp users.</p>
<p dir="auto">Changing the offsets for the Go To dialog box so that they start at 1, much like lines, seems to be a better fix.  Offset 1 would be the first character.  This would also make it consistent with the column number, which starts at 1. That change would break scripts that invoke the Go To box and use offset mode.</p>
<p dir="auto">-p on the command line likely should remain zero based.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/59112</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59112</guid><dc:creator><![CDATA[mkupper]]></dc:creator><pubDate>Mon, 26 Oct 2020 21:45:18 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to get the current line number into the copy/paste buffer? on Mon, 26 Oct 2020 19:16:56 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/59109">Is there a way to get the current line number into the copy/paste buffer?</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a></p>
<blockquote>
<p dir="auto">cannot replicate</p>
</blockquote>
<p dir="auto">You are doing <em>Line</em>.<br />
I was doing <em>Offset</em> (or <em>Position Offset</em>).</p>
</blockquote>
<p dir="auto">You’re right.  Offset is 0-based when the cursor is <em>before</em> the character.  So when your document is 757 bytes, then the cursor is before offset=757, but the last character (“you can’t go further than”) is at offset=756.  But if you type a number of 757 or greater in the box, it will properly move your cursor to after the last character.  So you can <em>try</em> to go further.  But it’s bad phrasing.  I would suggest that piece of text should be “offset of last character in file” rather than “you can’t go further than”</p>
]]></description><link>https://community.notepad-plus-plus.org/post/59110</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59110</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 26 Oct 2020 19:16:56 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to get the current line number into the copy/paste buffer? on Mon, 26 Oct 2020 19:10:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a></p>
<blockquote>
<p dir="auto">cannot replicate</p>
</blockquote>
<p dir="auto">You are doing <em>Line</em>.<br />
I was doing <em>Offset</em> (or <em>Position Offset</em>).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/59109</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59109</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 26 Oct 2020 19:10:08 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to get the current line number into the copy/paste buffer? on Mon, 26 Oct 2020 19:08:49 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/59101">Is there a way to get the current line number into the copy/paste buffer?</a>:</p>
<blockquote>
<p dir="auto">The funny part is the <em>You can’t go further than</em> number is less than the <em>You are here</em> number.</p>
</blockquote>
<p dir="auto">I cannot replicate.  If I <code>Ctrl+End</code> then <code>Ctrl+G</code>, I always see akin to:<br />
<img src="/assets/uploads/files/1603739312126-1d340b2e-d9d9-46b3-9c37-5e41216960bc-image.png" alt="1d340b2e-d9d9-46b3-9c37-5e41216960bc-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/59108</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59108</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 26 Oct 2020 19:08:49 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to get the current line number into the copy/paste buffer? on Mon, 26 Oct 2020 19:08:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</bdi></a> said in <a href="/post/59103">Is there a way to get the current line number into the copy/paste buffer?</a>:</p>
<blockquote>
<p dir="auto">Are there ways to add menu items to the main editor’s right click menu that can be linked to a new script?</p>
</blockquote>
<p dir="auto">Yes. in <code>contextMenu.xml</code> you can put a line like this:</p>
<pre><code class="language-z">&lt;Item PluginEntryName = "Python Script" PluginCommandItemName = "name_of_script_as_appears_in_plugin_menu" ItemNameAs = "name_you_want_to_see_in_context_menu" /&gt;
</code></pre>
<p dir="auto">EDIT: Peter answered before me, but we both gave good information so I won’t delete mine. :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/59107</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59107</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 26 Oct 2020 19:08:55 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to get the current line number into the copy/paste buffer? on Mon, 26 Oct 2020 19:06:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</bdi></a> said in <a href="/post/59103">Is there a way to get the current line number into the copy/paste buffer?</a>:</p>
<blockquote>
<p dir="auto">Are there ways to add menu items to the main editor’s right click menu that can be linked to a new script?  I see Plugin commands and under that Base64 Encode, Base64 Decode, and copy text with syntax highlighting.</p>
</blockquote>
<p dir="auto">Alan answered the others.  This one is <strong>Settings &gt; Edit Popup Context Menu</strong> (see for reference <a href="https://npp-user-manual.org/docs/config-files/#the-context-menu-contextmenu-xml" rel="nofollow ugc">https://npp-user-manual.org/docs/config-files/#the-context-menu-contextmenu-xml</a>)</p>
<p dir="auto"><strong>edit</strong>: if you <a href="https://community.notepad-plus-plus.org/search?term=contextMenu.xml&amp;in=posts&amp;matchWords=all&amp;sortBy=timestamp&amp;sortDirection=desc&amp;showAs=posts">search the forum</a> for “contextMenu.xml”, you will see examples of people’s edited context menus, if the official docs aren’t sufficient.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/59106</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59106</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 26 Oct 2020 19:06:18 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to get the current line number into the copy/paste buffer? on Mon, 26 Oct 2020 19:03:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</bdi></a> said in <a href="/post/59103">Is there a way to get the current line number into the copy/paste buffer?</a>:</p>
<blockquote>
<p dir="auto">Is there an easy way to discover which keyboard sequences are in use?</p>
</blockquote>
<p dir="auto">See <a href="https://community.notepad-plus-plus.org/topic/12576/list-of-all-assigned-keyboard-shortcuts">HERE</a>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/59105</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59105</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 26 Oct 2020 19:03:14 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to get the current line number into the copy/paste buffer? on Mon, 26 Oct 2020 19:01:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</bdi></a> said in <a href="/post/59103">Is there a way to get the current line number into the copy/paste buffer?</a>:</p>
<blockquote>
<p dir="auto">Can you provide a more complete script?  I don’t know the code to get a value into the copy/paste buffer for example.</p>
</blockquote>
<p dir="auto">Try this as your “complete script”:</p>
<pre><code class="language-z">editor.copyText(str(editor.lineFromPosition(editor.getCurrentPos())+1))
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/59104</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59104</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 26 Oct 2020 19:01:32 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to get the current line number into the copy/paste buffer? on Mon, 26 Oct 2020 18:44:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> Thank you.  Can you provide a more complete script?  I don’t know the code to get a value into the copy/paste buffer for example.</p>
<p dir="auto">Is there an easy way to discover which keyboard sequences are in use? For example, as crtl-g is the current go-to dialog I’d want to see if ctrl-shift-g or something similar is available on my system to map to a new script.</p>
<p dir="auto">Are there ways to add menu items to the main editor’s right click menu that can be linked to a new script?  I see Plugin commands and under that Base64 Encode, Base64 Decode, and copy text with syntax highlighting.</p>
<p dir="auto">Thank you.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/59103</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59103</guid><dc:creator><![CDATA[mkupper]]></dc:creator><pubDate>Mon, 26 Oct 2020 18:44:10 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to get the current line number into the copy/paste buffer? on Mon, 26 Oct 2020 18:37:28 GMT]]></title><description><![CDATA[<p dir="auto">Somewhat related:</p>
<p dir="auto">I was experimenting with the <em>Go to</em> window and noticed this:</p>
<p dir="auto"><img src="/assets/uploads/files/1603737321245-077c93e5-e817-454c-adf6-e134626ba455-image.png" alt="077c93e5-e817-454c-adf6-e134626ba455-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">The funny part is the <em>You can’t go further than</em> number is less than the <em>You are here</em> number.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/59101</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59101</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 26 Oct 2020 18:37:28 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to get the current line number into the copy/paste buffer? on Mon, 26 Oct 2020 18:27:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</bdi></a> said in <a href="/post/59099">Is there a way to get the current line number into the copy/paste buffer?</a>:</p>
<blockquote>
<p dir="auto">PythonScript.dll</p>
</blockquote>
<p dir="auto">You have PythonScript, so why not make a script which puts <code>editor.lineFromPosition(editor.getCurrentPos())+1</code> into the clipboard, and assign it to a keyboard shortcut of your choosing.  (The <code>+1</code> is needed because <code>lineFromPosition()</code> returns a line-number that starts at 0 for the first line of the file.)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/59100</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59100</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 26 Oct 2020 18:27:08 GMT</pubDate></item></channel></rss>