<?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[Should $(CURRENT_LINE) be zero-based?]]></title><description><![CDATA[<p dir="auto">Is there a reason for <code>$(CURRENT_LINE)</code> to be zero-based?</p>
<p dir="auto">Create a file <code>Test.vbs</code> containing the line <code>msgbox WScript.Arguments(0)</code>.<br />
Add <code>&lt;Command name="Test" Ctrl="no" Alt="no" Shift="no" Key="0"&gt;wscript.exe YourPath\Test.vbs $(CURRENT_LINE)&lt;/Command&gt;</code> to <code>shortcuts.xml</code>.<br />
Menu -&gt; Run -&gt; Test.</p>
<p dir="auto">If the caret is placed in line 6, <code>$(CURRENT_LINE)</code> returns 5.</p>
<p dir="auto">Thank you.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/15903/should-current_line-be-zero-based</link><generator>RSS for Node</generator><lastBuildDate>Sun, 09 Aug 2026 04:44:00 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/15903.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 08 Jun 2018 21:42:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Should $(CURRENT_LINE) be zero-based? on Sun, 10 Jun 2018 22:17:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/vitaliy-dovgan" aria-label="Profile: Vitaliy-Dovgan">@<bdi>Vitaliy-Dovgan</bdi></a>,</p>
<p dir="auto">Thank you for the info. I appreciate it.</p>
<blockquote>
<p dir="auto">Remembering all the Scintilla messages’ numbers (such as SCI_HIDELINES = 2227) are kind of hardcore.</p>
</blockquote>
<p dir="auto">Not for <a class="plugin-mentions-user plugin-mentions-a" href="/user/claudia-frank" aria-label="Profile: Claudia-Frank">@<bdi>Claudia-Frank</bdi></a>. :)</p>
<hr />
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a>,</p>
<p dir="auto">Regards.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/32928</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/32928</guid><dc:creator><![CDATA[Yaron]]></dc:creator><pubDate>Sun, 10 Jun 2018 22:17:41 GMT</pubDate></item><item><title><![CDATA[Reply to Should $(CURRENT_LINE) be zero-based? on Sun, 10 Jun 2018 20:37:59 GMT]]></title><description><![CDATA[<p dir="auto">NppExec can live with any version of $(CURRENT_LINE) :) E.g.:</p>
<pre><code>set local line ~ $(CURRENT_LINE) + 1 // in case of zero-based
"C:\Program Files\EditPad\EditPad.exe" "$(FULL_CURRENT_PATH)" /l$(line)/c$(CURRENT_COLUMN)
</code></pre>
<p dir="auto">or</p>
<pre><code>set local line ~ $(CURRENT_LINE) - 1 // in case of one-based
SCI_SENDMSG SCI_HIDELINES $(line) $(line)
</code></pre>
<p dir="auto">P.S. Remembering all the Scintilla messages’ numbers (such as SCI_HIDELINES = 2227) are kind of hardcore. My colleague once said he was learning all the main GUIDs present in Windows, but he was certainly joking :)<br />
The “NppExec” subfolder near to NppExec.dll contains header files which are read by NppExec at runtime to use string constants such as SCI_HIDELINES instead of numbers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/32927</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/32927</guid><dc:creator><![CDATA[Vitaliy Dovgan]]></dc:creator><pubDate>Sun, 10 Jun 2018 20:37:59 GMT</pubDate></item><item><title><![CDATA[Reply to Should $(CURRENT_LINE) be zero-based? on Sat, 09 Jun 2018 12:58:47 GMT]]></title><description><![CDATA[<p dir="auto">Claudia,</p>
<p dir="auto">Good point.</p>
<p dir="auto">Scott,</p>
<p dir="auto">Good idea.</p>
<p dir="auto">Thank you both.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/32916</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/32916</guid><dc:creator><![CDATA[Yaron]]></dc:creator><pubDate>Sat, 09 Jun 2018 12:58:47 GMT</pubDate></item><item><title><![CDATA[Reply to Should $(CURRENT_LINE) be zero-based? on Sat, 09 Jun 2018 12:52:50 GMT]]></title><description><![CDATA[<p dir="auto">Yaron, of course we could manipulate the output but does this makes sense?<br />
I don’t know how many macros/scripts/or_whatever_it_is_called are out there<br />
and do use the variable in conjunction with another call expecting this variable<br />
as paramter -&gt; all would have to be changed in this case</p>
<p dir="auto">Scott, it is hiding lines - just an example - nothing magic :-)<br />
But I would vote for having an additional variable which returns the “human expected” value.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/32915</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/32915</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Sat, 09 Jun 2018 12:52:50 GMT</pubDate></item><item><title><![CDATA[Reply to Should $(CURRENT_LINE) be zero-based? on Sat, 09 Jun 2018 12:44:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/claudia-frank" aria-label="Profile: Claudia-Frank">@<bdi>Claudia-Frank</bdi></a> : Hmmm…have to look up 2227…what could take two parameters of current-line?..what magic is CF up to now?..hmmm…</p>
<p dir="auto">All:  Maybe the best solution is some new things being created, perhaps <code>$(CURRENT_LINE1)</code> and <code>$(CURRENT_COLUMN1)</code>, or whatever names are most appropriate…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/32914</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/32914</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Sat, 09 Jun 2018 12:44:36 GMT</pubDate></item><item><title><![CDATA[Reply to Should $(CURRENT_LINE) be zero-based? on Sat, 09 Jun 2018 12:43:32 GMT]]></title><description><![CDATA[<p dir="auto">Claudia,</p>
<p dir="auto">Can you use</p>
<pre><code>SCI_SENDMSG 2227 $(CURRENT_LINE)-1
</code></pre>
<p dir="auto">?<br />
I think you can’t achieve that in the command line.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/32913</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/32913</guid><dc:creator><![CDATA[Yaron]]></dc:creator><pubDate>Sat, 09 Jun 2018 12:43:32 GMT</pubDate></item><item><title><![CDATA[Reply to Should $(CURRENT_LINE) be zero-based? on Sat, 09 Jun 2018 12:37:08 GMT]]></title><description><![CDATA[<p dir="auto">But that would mean, that, for example, we cannot use</p>
<pre><code>SCI_SENDMSG 2227 $(CURRENT_LINE) $(CURRENT_LINE)
</code></pre>
<p dir="auto">in NppExec anymore and this is true for all other messages which uses CURRENT_LINE as being a parameter in the call.</p>
<p dir="auto">Maybe I’m wrong but I still think it is correct as it is.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/32912</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/32912</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Sat, 09 Jun 2018 12:37:08 GMT</pubDate></item><item><title><![CDATA[Reply to Should $(CURRENT_LINE) be zero-based? on Sat, 09 Jun 2018 12:36:47 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">Ah…<a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> was right…Editpad…the heresy!</p>
</blockquote>
<p dir="auto">Actually, the heresy was merely mentioning “other editor”.<br />
The explicit name was my reply to his question.</p>
<p dir="auto">I solemnly swear that I am up to no good. :)</p>
<blockquote>
<p dir="auto">There’s a $(CURRENT_COLUMN) variable supported in Notepad++??</p>
</blockquote>
<pre><code>					if (internalVar == CURRENT_LINE || internalVar == CURRENT_COLUMN)
					{
						auto lineNumber = ::SendMessage(hWnd, RUNCOMMAND_USER + internalVar, 0, 0);
						wsprintf(expandedStr, TEXT("%d"), lineNumber + 1);	
					}
</code></pre>
<p dir="auto">And it’s also zero-based.<br />
Adding <code>+1</code> fixes both line and column.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/32911</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/32911</guid><dc:creator><![CDATA[Yaron]]></dc:creator><pubDate>Sat, 09 Jun 2018 12:36:47 GMT</pubDate></item><item><title><![CDATA[Reply to Should $(CURRENT_LINE) be zero-based? on Sat, 09 Jun 2018 10:39:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/claudia-frank" aria-label="Profile: Claudia-Frank">@<bdi>Claudia-Frank</bdi></a> said:</p>
<blockquote>
<p dir="auto">So in such cases I think keeping its native feature does make more sense</p>
</blockquote>
<p dir="auto">I wasn’t advocating for change (I’ll let <a class="plugin-mentions-user plugin-mentions-a" href="/user/yaron" aria-label="Profile: Yaron">@<bdi>Yaron</bdi></a> do that!)…just opining that the few times I remember considering using <code>$(CURRENT_LINE)</code> for something, I realized I couldn’t do it because of the offset-by-1 for what I needed at the time (can’t really remember what I was attempting…).</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/yaron" aria-label="Profile: Yaron">@<bdi>Yaron</bdi></a> :  Ah…<a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> was right…Editpad…the heresy!  :-D</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/yaron" aria-label="Profile: Yaron">@<bdi>Yaron</bdi></a> : There’s a <code>$(CURRENT_COLUMN)</code> variable supported in Notepad++??</p>
]]></description><link>https://community.notepad-plus-plus.org/post/32908</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/32908</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Sat, 09 Jun 2018 10:39:46 GMT</pubDate></item><item><title><![CDATA[Reply to Should $(CURRENT_LINE) be zero-based? on Sat, 09 Jun 2018 09:03:24 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">a possible solution might be to chose a language which uses<br />
0 based indexes</p>
</blockquote>
<p dir="auto"><code>Test.vbs</code> was just an example.</p>
<p dir="auto">I’m actually using<br />
<code>&lt;Command name="Open in EditPad..." Ctrl="no" Alt="no" Shift="no" Key="0"&gt;&amp;quot;C:\Program Files\EditPad\EditPad.exe&amp;quot; &amp;quot;$(FULL_CURRENT_PATH)&amp;quot; /l$(CURRENT_LINE)/c$(CURRENT_COLUMN)&lt;/Command&gt; </code></p>
<blockquote>
<p dir="auto">how to distinguish between used internally and externally</p>
</blockquote>
<p dir="auto">If I understand it correctly, <code>$(CURRENT_LINE)</code> is meant for interacting with <a href="http://docs.notepad-plus-plus.org/index.php/External_Programs" rel="nofollow ugc">External Programs</a>.<br />
NPP uses <code>getCurrentLineNumber()</code> and adds <code>+1</code> when necessary (e.g. setting <code>Ln</code> in the status bar).</p>
<p dir="auto">So apparently</p>
<pre><code>wsprintf(expandedStr, TEXT("%d"), lineNumber);
</code></pre>
<p dir="auto">in <code>RunDlg.cpp</code> should be changed to</p>
<pre><code>wsprintf(expandedStr, TEXT("%d"), lineNumber + 1);
</code></pre>
<p dir="auto">Thank you.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/32907</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/32907</guid><dc:creator><![CDATA[Yaron]]></dc:creator><pubDate>Sat, 09 Jun 2018 09:03:24 GMT</pubDate></item><item><title><![CDATA[Reply to Should $(CURRENT_LINE) be zero-based? on Sat, 09 Jun 2018 02:50:32 GMT]]></title><description><![CDATA[<p dir="auto">I see where this could become handy but I do also see where this would be problematic.<br />
Like you said, how to distinguish between used internally and externally.<br />
If you change it to get work with external programs which do assume 1based indexing<br />
you open the door to complain for those who use it internally.<br />
So in such cases I think keeping its native feature does make more sense.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/32905</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/32905</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Sat, 09 Jun 2018 02:50:32 GMT</pubDate></item><item><title><![CDATA[Reply to Should $(CURRENT_LINE) be zero-based? on Sat, 09 Jun 2018 02:35:08 GMT]]></title><description><![CDATA[<p dir="auto">It is not an issue if one stays “within” Notepad++/Scintilla, but a typical use might be in interacting with other tools that you don’t control the source of (can’t edit/rebuild).  These tools would typically expect a <em><strong>user</strong></em> line number (1-indexed) rather than the 0-indexed value provided by <code>$(CURRENT_LINE)</code>.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/yaron" aria-label="Profile: Yaron">@<bdi>Yaron</bdi></a> 's example would be perfect if he didn’t “control the source” of his <code>Test.vbs</code>.  Clearly, he could adjust the number his vbs receives by increasing by one whatever comes in, by editing the code.  Unfortunately, we don’t always have the luxury of having the code or being able to change/recompile it to make such an adjustment.</p>
<p dir="auto">Think about an error parser for a compiler.  The compiler outputs warnings/errors with a filename and a line number (and sometimes a column number too) to indicate where the problem occurred.  I have never seen such a line(/column) number be zero-based; it’s always one-based because the output is intended first-and-foremost for the humans, whose first thought is to start counting from 1 not 0.</p>
<p dir="auto">My 2c…maybe I need some change back…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/32904</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/32904</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Sat, 09 Jun 2018 02:35:08 GMT</pubDate></item><item><title><![CDATA[Reply to Should $(CURRENT_LINE) be zero-based? on Sat, 09 Jun 2018 02:19:15 GMT]]></title><description><![CDATA[<p dir="auto">Actually I think having $(CURRENT_LINE) not being 0-indexed doesn’t make sense.<br />
Value comes from scintilla and can be past to scintilla so why should npp add and<br />
substract a value to get the <strong>correct</strong> line if it just can pass the value.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/yaron" aria-label="Profile: Yaron">@<bdi>Yaron</bdi></a> - a possible solution might be to chose a language which uses<br />
0 based indexes - like … :-D you know it :-D</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/32903</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/32903</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Sat, 09 Jun 2018 02:19:15 GMT</pubDate></item><item><title><![CDATA[Reply to Should $(CURRENT_LINE) be zero-based? on Sat, 09 Jun 2018 00:27:38 GMT]]></title><description><![CDATA[<p dir="auto">I have encountered this before and I fully agree with <a class="plugin-mentions-user plugin-mentions-a" href="/user/yaron" aria-label="Profile: Yaron">@<bdi>Yaron</bdi></a> .  Having <code>$(CURRENT_LINE)</code> being zero-based pretty much destroys its usefulness for any purpose.  :-(</p>
]]></description><link>https://community.notepad-plus-plus.org/post/32897</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/32897</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Sat, 09 Jun 2018 00:27:38 GMT</pubDate></item><item><title><![CDATA[Reply to Should $(CURRENT_LINE) be zero-based? on Fri, 08 Jun 2018 22:24:07 GMT]]></title><description><![CDATA[<p dir="auto">EditPad. :)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/32896</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/32896</guid><dc:creator><![CDATA[Yaron]]></dc:creator><pubDate>Fri, 08 Jun 2018 22:24:07 GMT</pubDate></item><item><title><![CDATA[Reply to Should $(CURRENT_LINE) be zero-based? on Fri, 08 Jun 2018 22:22:18 GMT]]></title><description><![CDATA[<p dir="auto">What’s this “other editor” heresy? ;-)</p>
<p dir="auto">(makes sense, really)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/32895</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/32895</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Fri, 08 Jun 2018 22:22:18 GMT</pubDate></item><item><title><![CDATA[Reply to Should $(CURRENT_LINE) be zero-based? on Fri, 08 Jun 2018 22:18:30 GMT]]></title><description><![CDATA[<p dir="auto">Practically it’s not the expected behavior IMO.<br />
I want to open the current file and line in a different editor and get the wrong line.<br />
Using the <code>Current Line</code> argument in other editors you get the correct line.</p>
<p dir="auto">Thank you.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/32894</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/32894</guid><dc:creator><![CDATA[Yaron]]></dc:creator><pubDate>Fri, 08 Jun 2018 22:18:30 GMT</pubDate></item><item><title><![CDATA[Reply to Should $(CURRENT_LINE) be zero-based? on Fri, 08 Jun 2018 22:07:40 GMT]]></title><description><![CDATA[<p dir="auto">Probably because <a href="https://www.scintilla.org/ScintillaDoc.html#SCI_GETLINE" rel="nofollow ugc">SCI_GETLINE</a> say “lines start at 0” and <a href="https://www.scintilla.org/ScintillaDoc.html#SCI_GOTOLINE" rel="nofollow ugc">SCI_GOTOLINE</a> says “first line is 0”. Apparently, Scintilla made the decision to be computer-sciencey about their line numbering API.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/32893</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/32893</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Fri, 08 Jun 2018 22:07:40 GMT</pubDate></item></channel></rss>