<?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[Python plugin - problem with setFirstVisibleLine]]></title><description><![CDATA[<p dir="auto">Hi, I have a script that finds the function declaration of the word under the cursor. E,g, in the following example, I select <code>A()</code> within function B, run the script, and it takes me to the line of <code>def A():</code></p>
<pre><code>def A():
    pass

def B():
    A()
</code></pre>
<p dir="auto">The problem I’m having is as follows:<br />
I use <code>editor.lineFromPosition(pos)</code> to get the line number of the found function, and I use <code>editor.setFirstVisibleLine</code> to go to that line.<br />
However, I realized tonight that <code>editor.lineFromPosition()</code> gives you the absolute line number of that position, but <code>editor.setFirstVisibleLine</code> doesn’t set the line to the absolute line of that number because it doesn’t take <strong>hidden lines</strong> into consideration!<br />
To explain a little more:</p>
<ul>
<li>if <code>editor.lineFromPosition()</code> returned 100</li>
<li>Between 1 and 100, there are 10 hidden lines (by folding)</li>
<li>I want line 100 to be the first visible line</li>
<li><code>editor.setFirstVisibleLine(100)</code> will show line 110!</li>
</ul>
<p dir="auto">I hope this is clear…<br />
How am I supposed to overcome this???</p>
<p dir="auto">Thanks,<br />
Davey</p>
<p dir="auto">P.S. gotoLine(100) does work properly, but this doesn’t set it at the top of the view</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/11092/python-plugin-problem-with-setfirstvisibleline</link><generator>RSS for Node</generator><lastBuildDate>Sat, 14 Nov 2026 15:38:03 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/11092.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 11 Jan 2016 02:18:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Python plugin - problem with setFirstVisibleLine on Mon, 11 Jan 2016 14:35:45 GMT]]></title><description><![CDATA[<p dir="auto">Hi Scott, thanks<br />
Yes, I do recognize that forum, I actually have some scripts there I think<br />
I was actually debating for a few minutes where to post it… :)</p>
<p dir="auto">Thanks,<br />
Davey</p>
]]></description><link>https://community.notepad-plus-plus.org/post/13193</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/13193</guid><dc:creator><![CDATA[DaveyD]]></dc:creator><pubDate>Mon, 11 Jan 2016 14:35:45 GMT</pubDate></item><item><title><![CDATA[Reply to Python plugin - problem with setFirstVisibleLine on Mon, 11 Jan 2016 11:51:08 GMT]]></title><description><![CDATA[<p dir="auto">Both visibleFromDocLine() and docLineFromVisible()…and setFirstVisibleLine() are in the pythonscript documentation.</p>
<p dir="auto">I’d also like to point out the pythonscript has its own discussion area separate from the Notepad++ Community one.  It is found here:</p>
<p dir="auto"><a href="https://sourceforge.net/p/npppythonscript/discussion/" rel="nofollow ugc">https://sourceforge.net/p/npppythonscript/discussion/</a></p>
<p dir="auto">I’m not saying not to post pythonscript related stuff here, just pointing that other forum out as an option.  :)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/13190</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/13190</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Mon, 11 Jan 2016 11:51:08 GMT</pubDate></item><item><title><![CDATA[Reply to Python plugin - problem with setFirstVisibleLine on Mon, 11 Jan 2016 03:39:46 GMT]]></title><description><![CDATA[<p dir="auto">Awesome Claudia!<br />
Thanks a ton - I knew there had to be some better method!<br />
You saved me a lot of time!</p>
<p dir="auto">Thank you!<br />
Davey</p>
<p dir="auto">(P.S. I searched all the docs for <strong>Line</strong> and <strong>Visible</strong> - but I didnt see this! Weird!)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/13184</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/13184</guid><dc:creator><![CDATA[DaveyD]]></dc:creator><pubDate>Mon, 11 Jan 2016 03:39:46 GMT</pubDate></item><item><title><![CDATA[Reply to Python plugin - problem with setFirstVisibleLine on Mon, 11 Jan 2016 03:38:16 GMT]]></title><description><![CDATA[<p dir="auto">no - I guess you need</p>
<p dir="auto">editor.visibleFromDocLine<br />
and<br />
editor.docLineFromVisible<br />
together with<br />
setFirstVisibleLine</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/13183</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/13183</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Mon, 11 Jan 2016 03:38:16 GMT</pubDate></item><item><title><![CDATA[Reply to Python plugin - problem with setFirstVisibleLine on Mon, 11 Jan 2016 03:35:49 GMT]]></title><description><![CDATA[<p dir="auto">:) Thanks<br />
It doesn’t sound right - correct?</p>
<p dir="auto">Anyway, I’ll let you know what I come out with… if I do! :)<br />
Thanks for your help!<br />
Davey</p>
]]></description><link>https://community.notepad-plus-plus.org/post/13182</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/13182</guid><dc:creator><![CDATA[DaveyD]]></dc:creator><pubDate>Mon, 11 Jan 2016 03:35:49 GMT</pubDate></item><item><title><![CDATA[Reply to Python plugin - problem with setFirstVisibleLine on Mon, 11 Jan 2016 03:28:43 GMT]]></title><description><![CDATA[<p dir="auto">Hi Davey,</p>
<p dir="auto">now I get it, never used editor.setFirstVisibleLine before<br />
and my test was done with your ~20 lines of description, so nothing really changed by using this call with parameter 100 <em>shame</em></p>
<p dir="auto">You are right, from the documentation it looks like you have to do it<br />
SCI_GETALLLINESVISIBLE  to see if something is hidden at all.<br />
And loop SCI_GETLINEVISIBLE(int line) to get the hidden lines, count it and … hm …<br />
I guess it makes a difference if the hidden lines are under the line you want to be on the top or before.<br />
So, count the lines which are before your line … or … !?</p>
<p dir="auto">Let me know - I have to go to work soon ;-)</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/13181</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/13181</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Mon, 11 Jan 2016 03:28:43 GMT</pubDate></item><item><title><![CDATA[Reply to Python plugin - problem with setFirstVisibleLine on Mon, 11 Jan 2016 03:16:38 GMT]]></title><description><![CDATA[<p dir="auto">Hi Claudia,<br />
Thanks, but this also doesn’t bring it to the top of the screen<br />
Maybe I have to do just create my own loop to keep testing whether the line I want is at the top…??<br />
Sounds weird… is it true?</p>
<p dir="auto">Thanks<br />
Davey</p>
]]></description><link>https://community.notepad-plus-plus.org/post/13180</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/13180</guid><dc:creator><![CDATA[DaveyD]]></dc:creator><pubDate>Mon, 11 Jan 2016 03:16:38 GMT</pubDate></item><item><title><![CDATA[Reply to Python plugin - problem with setFirstVisibleLine on Mon, 11 Jan 2016 03:10:09 GMT]]></title><description><![CDATA[<p dir="auto">I guess you are looking for editor.gotoPos(pos)</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/13178</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/13178</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Mon, 11 Jan 2016 03:10:09 GMT</pubDate></item></channel></rss>