<?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[Show only lines that contain a search term]]></title><description><![CDATA[<p dir="auto">I’m opening this thread as a placeholder for continuing the discussion begun in <a href="https://community.notepad-plus-plus.org/topic/20058">THIS THREAD</a> (see the Dec 17, 2022 9:50AM posting).</p>
<p dir="auto">What was wanted was a capability where <em>only the lines with “string” in it are displayed and may be edited</em>.</p>
<p dir="auto">In the other thread, I hinted that I already have such a script, but in preparing it for sharing here, as often happens, I started “working on it”.  :-)</p>
<p dir="auto">It is “done”, but when I got it to its current point, I got to thinking about how it might be a better script if it “played better” with Notepad++'s own <em>Hide Lines</em> feature.  So I’m currently experimenting with that angle and will post more here when I sort that out…</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/23929/show-only-lines-that-contain-a-search-term</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 02:26:18 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/23929.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 22 Dec 2022 15:27:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Show only lines that contain a search term on Tue, 24 Jan 2023 18:27:08 GMT]]></title><description><![CDATA[<p dir="auto">Due to the problem seen earlier, I decided to take another approach, so that Notepad++ would cooperate better with the lines I was hiding in order to achieve the goals of the script.</p>
<p dir="auto">Unfortunately, I’ve encountered too many bugs with the hidden lines feature, that it isn’t worth continuing.  I think that, at least for now, I’m giving up on this idea…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/83587</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/83587</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 24 Jan 2023 18:27:08 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Sat, 07 Jan 2023 11:04:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22926">@Paul-Wormer</a> said in <a href="/post/83112">Show only lines that contain a search term</a>:</p>
<blockquote>
<p dir="auto">A quick fix for the “strangeness with hidden lines” is hiding all lines twice in a row.</p>
</blockquote>
<p dir="auto">Meh.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/83113</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/83113</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 07 Jan 2023 11:04:15 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Sat, 07 Jan 2023 09:39:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a> said</p>
<blockquote>
<p dir="auto">I don’t know that that script, being “simpler”, has anything over-and-above my “complicated”(?) one, given that it appears the strangeness with hidden lines continues in that script…</p>
</blockquote>
<p dir="auto">Your script has a fairly sophisticated UI, colors the  margin of the displayed lines, and marks the strings found. My script has none of that. Therefore it has exactly 4 times less lines than yours.  A quick fix for the “strangeness with hidden lines” is hiding all lines twice in a row. I’m very interested  in hearing about cases where that fix breaks down. In the meantime I have tested the script a lot and so far the fix seems to work, but you never know …</p>
]]></description><link>https://community.notepad-plus-plus.org/post/83112</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/83112</guid><dc:creator><![CDATA[Paul Wormer]]></dc:creator><pubDate>Sat, 07 Jan 2023 09:39:15 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Fri, 06 Jan 2023 17:22:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22926">@Paul-Wormer</a> said in <a href="/post/83103">Show only lines that contain a search term</a>:</p>
<blockquote>
<p dir="auto">For a simple script</p>
</blockquote>
<p dir="auto">I don’t know that that script, being “simpler”, has anything over-and-above my “complicated”(?) one, given that it appears the strangeness with hidden lines continues in that script…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/83104</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/83104</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 06 Jan 2023 17:22:19 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Fri, 06 Jan 2023 17:04:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a> For a simple script, see <a href="https://community.notepad-plus-plus.org/topic/20058/how-do-i-move-bookmarks-to-a-copy-of-the-same-file/20">https://community.notepad-plus-plus.org/topic/20058/how-do-i-move-bookmarks-to-a-copy-of-the-same-file/20</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/83103</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/83103</guid><dc:creator><![CDATA[Paul Wormer]]></dc:creator><pubDate>Fri, 06 Jan 2023 17:04:08 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Thu, 05 Jan 2023 19:37:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@PeterJones</a> said in <a href="/post/83061">Show only lines that contain a search term</a>:</p>
<blockquote>
<p dir="auto">Was there anything else that would prevent it from being used?</p>
</blockquote>
<p dir="auto">Maybe my use of “…at all” came off as a little strong…  I can’t see that it would corrupt data or do anything “bad”.</p>
<p dir="auto">I think the downside to wider use is only the complaints that could arise in the form of “hey, this isn’t working right”.  If a tool is supposed to do “X”, and it doesn’t do “X” correctly, well…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/83062</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/83062</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 05 Jan 2023 19:37:57 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Thu, 05 Jan 2023 19:27:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a> , in <a href="https://community.notepad-plus-plus.org/post/83060">the other thread</a>, said,</p>
<blockquote>
<p dir="auto">I don’t know if we should recommend that script at <em>all</em> until its shortcomings have been addressed.</p>
</blockquote>
<p dir="auto">I will admit I haven’t used it much (just the experiments I described yesterday).  But my impression was that the redraw bug (which I can get around by changing tabs and back) and slowness (which is to be expected on something like this) were the issues.  Was there anything else that would prevent it from being used?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/83061</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/83061</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 05 Jan 2023 19:27:27 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Tue, 03 Jan 2023 18:47:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26608">@datatraveller1</a> , <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a> , <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22926">@Paul-Wormer</a>,</p>
<p dir="auto">The first time I created the script, and ran it, it properly filtered (showed <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26608">@datatraveller1</a>’s screenshot).  And every subsequent run in that load of Notepad++ worked properly.</p>
<p dir="auto">I then restarted Notepad++, and the first run after restarting gave more lines (some of the comment lines).  If I run it and do the clear (shift+OK), then run it to highlight again, it works correctly.  If I restart NPP and re-run to get the extra lines, then run again with the same exact search string (not shifted), it filters correctly.</p>
<p dir="auto">The sequence behaves the same when searching for <code>self.settings_by_viewfile_dict</code> or just <code>self</code>.</p>
<p dir="auto">I set the debug flag to TRUE (set that line to a 1 not a 0), restarted Notepad++, and then ran with the longer search string again.<br />
For the bad highlight:</p>
<pre><code>LFVH1&lt;DBG&gt;: view_plus_file: 0C:\Users\PJones2\AppData\Roaming\Notepad++\plugins\config\PythonScript\scripts\nppCommunity\23xxx\23929-AlanK-LineFilterViaHiding1.py
LFVH1&lt;DBG&gt;: view_plus_file: 0C:\Users\PJones2\AppData\Roaming\Notepad++\plugins\config\PythonScript\scripts\nppCommunity\23xxx\23929-AlanK-LineFilterViaHiding1.py
LFVH1&lt;DBG&gt;: L: [(1648, 1678), (2255, 2285), (2749, 2779), (2939, 2969), (4190, 4220), (4449, 4479), (5182, 5212), (5265, 5295), (5675, 5705), (6407, 6437), (6936, 6966), (7047, 7077), (9877, 9907), (9922, 9952)]
</code></pre>
<p dir="auto">for the good highlight immediately after:</p>
<pre><code>LFVH1&lt;DBG&gt;: view_plus_file: 0C:\Users\PJones2\AppData\Roaming\Notepad++\plugins\config\PythonScript\scripts\nppCommunity\23xxx\23929-AlanK-LineFilterViaHiding1.py
LFVH1&lt;DBG&gt;: L: [(1648, 1678), (2255, 2285), (2749, 2779), (2939, 2969), (4190, 4220), (4449, 4479), (5182, 5212), (5265, 5295), (5675, 5705), (6407, 6437), (6936, 6966), (7047, 7077), (9877, 9907), (9922, 9952)]
</code></pre>
<p dir="auto">There is no difference in the L list, which says that the problem doesn’t lie in the searching/list, but rather someplace else.</p>
<p dir="auto">Additional datapoint: if I have the bad filter (with extra comments showing), switch to another tab, and switch back, it shows the <em>correct</em> filtering, with the debug info:</p>
<pre><code>LFVH1&lt;DBG&gt;: BUFFERACTIVATED: {'code': 1010, 'bufferID': 3019234076800L}
LFVH1&lt;DBG&gt;: view_plus_file: 0C:\Users\PJones2\AppData\Roaming\Notepad++\plugins\config\PythonScript\scripts\nppCommunity\23xxx\23929-AlanK-LineFilterViaHiding1.py
</code></pre>
<p dir="auto">If I take original line#114 – the <code>self.freshen_user_view_of_active_tab()</code> at the end of <code>prompt_for_string_to_match()</code>'s definition – and duplicate it, so it runs that freshen twice, on the first freshen, it shows wrong; on the second, it shows right.</p>
<p dir="auto">I’m wondering if before the “hide” side of that command, if you need to clear all the lineVisible flags to known values before your script does its hiding… maybe the active lexer or other NPP feature has already tagged some lines in a way that confuses your logic.</p>
<p dir="auto">That’s probably all the time I’ll have for helping debug this today, but I hope some of that info turns out to be useful.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/82991</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/82991</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Tue, 03 Jan 2023 18:47:10 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Tue, 03 Jan 2023 18:09:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a> ok, sometimes debugging code can also contain errors, but this does not apply in your case.</p>
<p dir="auto">I still get correct results no matter what I filter for :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/82990</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/82990</guid><dc:creator><![CDATA[datatraveller1]]></dc:creator><pubDate>Tue, 03 Jan 2023 18:09:24 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Tue, 03 Jan 2023 18:04:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26608">@datatraveller1</a> said in <a href="/post/82988">Show only lines that contain a search term</a>:</p>
<blockquote>
<p dir="auto">I have noticed that your line numbers don’t match my line numbers</p>
</blockquote>
<p dir="auto">I said before “<em>(Don’t be concerned if my line numbers don’t match yours)</em>”.</p>
<p dir="auto">The reason for any mismatches would be because I’ve inserted some extra debugging statements in to possibly help solve the problem.  As I’m seeing the undesired results with the original code or any variant, what I’ve changed isn’t causing the problem.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/82989</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/82989</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 03 Jan 2023 18:04:30 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Tue, 03 Jan 2023 18:00:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a> and <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22926">@Paul-Wormer</a></p>
<p dir="auto">I have noticed that your line numbers don’t match my line numbers, e.g. my (correct) first occurence of <code>self.settings_by_viewfile_dict</code> is line 42.<br />
I use the script <a href="https://community.notepad-plus-plus.org/post/82787">https://community.notepad-plus-plus.org/post/82787</a> - Are you perhaps using a different script with potentially problematic changes? Does the problem also occur with this original version?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/82988</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/82988</guid><dc:creator><![CDATA[datatraveller1]]></dc:creator><pubDate>Tue, 03 Jan 2023 18:00:07 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Tue, 03 Jan 2023 18:06:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a> said in <a href="/post/82984">Show only lines that contain a search term</a>:</p>
<blockquote>
<p dir="auto">I think the key idea behind the script is you can edit in the filtered view.</p>
</blockquote>
<p dir="auto">THIS!  There is a <code>vi</code> mode for this IIRC, but I just figured with all the plugins and search window in Notepad++ never supporting this editing of the filtered view - just putting the results into a different view - we’d just never get it.</p>
<p dir="auto">Thanks <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a> - I assigned a hotkey and will try getting this filtered editing into my workflow.</p>
<p dir="auto">Cheers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/82986</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/82986</guid><dc:creator><![CDATA[Michael Vincent]]></dc:creator><pubDate>Tue, 03 Jan 2023 18:06:46 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Tue, 03 Jan 2023 15:11:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26608">@datatraveller1</a> said in <a href="/post/82983">Show only lines that contain a search term</a>:</p>
<blockquote>
<p dir="auto">I’m not sure - what does PC speed have to do with line visibility?</p>
</blockquote>
<p dir="auto">I don’t think it has anything to do with it, but until the root cause is found, everything is “on the table” as a possible problem.</p>
<blockquote>
<p dir="auto">Doesn’t “Find All in Current Document” basically do the same thing as the Python script?</p>
</blockquote>
<p dir="auto">I think the key idea behind the script is you can edit in the filtered view.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/82984</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/82984</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 03 Jan 2023 15:11:16 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Tue, 03 Jan 2023 15:01:21 GMT]]></title><description><![CDATA[<p dir="auto">Hi all,<br />
Just two thoughts</p>
<ol>
<li>
<p dir="auto">I’m not sure - what does PC speed have to do with line visibility?</p>
</li>
<li>
<p dir="auto">Doesn’t “<strong>Find All in Current Document</strong>” basically do the same thing as the Python script? Actually, the Notepad++ programmer just has to output the same thing in the same window to filter the text, doesn’t he?</p>
</li>
</ol>
]]></description><link>https://community.notepad-plus-plus.org/post/82983</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/82983</guid><dc:creator><![CDATA[datatraveller1]]></dc:creator><pubDate>Tue, 03 Jan 2023 15:01:21 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Tue, 03 Jan 2023 13:16:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> said in <a href="/post/82981">Show only lines that contain a search term</a>:</p>
<blockquote>
<p dir="auto">I have not finished cleaning my old micro and moved all my data yet,</p>
</blockquote>
<p dir="auto">What is taking so long?  Are you ever going to finish with this?? :-)</p>
<hr />
<blockquote>
<p dir="auto">I still use a USB key containing the N++ portable version 8.4.6 for all my tests, which must certainly slow down the execution of your Python script ??</p>
</blockquote>
<p dir="auto">I don’t see how…everything should be “in memory” for the operations of the script.</p>
<hr />
<blockquote>
<p dir="auto">I’m really surprised that I never encountered any visible false lines during my tests</p>
</blockquote>
<p dir="auto">Yes that is interesting…</p>
<hr />
<blockquote>
<p dir="auto">You should indeed remove these false positive answers, first of all !</p>
</blockquote>
<p dir="auto">Indeed.  However, at the moment, I’m out of ideas on what the problem might be. :-(</p>
]]></description><link>https://community.notepad-plus-plus.org/post/82982</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/82982</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 03 Jan 2023 13:16:45 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Tue, 03 Jan 2023 13:13:48 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@alan-kilborn</a> and <strong>All</strong>,</p>
<p dir="auto">Ah…OK. I understand your <strong>working</strong> method. You should indeed remove these <strong>false positive</strong> answers, first of all !</p>
<hr />
<p dir="auto">By the way, I’m really <strong>surprised</strong> that I <strong>never</strong> encountered any <strong>visible false</strong> lines during my tests, even in the case of a <strong>heavy</strong> file ! However, my laptop is not a <em>WAR LIGHTNING</em> ! Bought in <strong><code>July 2021</code></strong>, this HP laptop comes with <strong><code>Window 10 Pro 64</code></strong>, a <strong><code>512 Mb</code></strong> Solid State Drive and <strong><code>16 Mb DDR4</code></strong> of RAM.</p>
<p dir="auto">Moreover, as I have <strong>not</strong> finished cleaning my <strong>old</strong> micro and moved all my data <strong>yet</strong>, I still use a <strong><code>USB</code></strong> key containing the N++ <strong>portable</strong> version <strong><code>8.4.6</code></strong> for <strong>all</strong> my tests, which must certainly <strong>slow down</strong> the execution of your <strong><code>Python</code></strong> script ??</p>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/82981</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/82981</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Tue, 03 Jan 2023 13:13:48 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Tue, 03 Jan 2023 11:47:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> said in <a href="/post/82977">Show only lines that contain a search term</a>:</p>
<blockquote>
<p dir="auto">as I increased the size of the test file, the waiting time to get the line margin highlighted, in salmon color, increased in parallel</p>
</blockquote>
<p dir="auto">I did mention earlier: “<em>Large files may produce performance problems. Scripts aren’t blazingly fast…</em>”</p>
<p dir="auto">I use a variant of this script on what I consider a large file (in the work that I do).  It works acceptably, performance wise.</p>
<p dir="auto">HOWEVER: The correctness (or rather incorrectness) problem observed by some users needs to be addressed; if it doesn’t show/hide the correct lines, who cares how fast/slow it is?</p>
<hr />
<blockquote>
<p dir="auto">wouldn’t it be better to :<br />
Trigger a usual Mark action, with the Bookmark line option set<br />
Elaborate a Python script which simply would hide ALL non-marked lines, from the Mark results !</p>
</blockquote>
<p dir="auto">The downsides to that approach are:</p>
<ul>
<li>It requires multiple steps</li>
<li>Bookmarks become dedicated to that purpose (I like to “filter lines” and then set meaningful bookmarks on only <em>some</em> of the matches, before revealing all lines again and continuing to work with what I’ve bookmarked)</li>
</ul>
<p dir="auto">The user interface of the script could evolve to allow things like regex, match-case, etc.  But…let’s go for correctness first.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/82979</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/82979</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 03 Jan 2023 11:47:23 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Tue, 03 Jan 2023 02:18:09 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@alan-kilborn</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22926">@paul-wormer</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26608">@datatraveller1</a> and <strong>All</strong>,</p>
<p dir="auto">Well, I finished the traditional sequence of <strong>greetings</strong>, by phone, SMS and letters. So I just tested your <strong>Python</strong> script, <strong>Alan</strong>, and here are the results of my <strong>experiments</strong> !</p>
<hr />
<ul>
<li>
<p dir="auto">Personally, I <strong>never</strong> saw the case of <strong>visible</strong> lines <strong>not</strong> containing the <strong>literal</strong> string to search for. Good point !</p>
</li>
<li>
<p dir="auto">Like you, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@alan-kilborn</a>, I used the <strong><code>License.txt</code></strong> file, which I <strong>duplicated</strong> several times and enter the <strong>lower</strong>-case word <strong><code>free</code></strong> when running the script And, as I <strong>increased</strong> the size of the <strong>test</strong> file, the <strong>waiting</strong> time to get the line margin <strong>highlighted</strong>, in <strong>salmon</strong> color, increased in parallel :</p>
</li>
</ul>
<pre><code class="language-diff">                   Search of the literal lower-case word 'free'

Times "License.txt"             Size                  Lines       Hiding lines time
---------------------------------------------------------------------------------------
license.txt ×    1            35,500 bytes            231 lines          0,4  s
license.txt ×    5           177,500 bytes          1,155 lines          1,95 s
license.txt ×   10           355,000 bytes          2,310 lines          3,5  s
license.txt ×   50         1,775,000 bytes         11,550 lines         17    s
license.txt ×  100         3,550,000,bytes         23,100 lines         34    s
license.txt ×  500        17,750,000 bytes        115,500 lines        165    s
license.txt × 1000        35,500,000,bytes        231,000 lines        335    s
</code></pre>
<p dir="auto">Now, if we choose to look for the <strong>literal</strong> string <strong><code>COPYING</code></strong>, which occurs <strong>once</strong> only in the <strong><code>license.txt</code></strong> file ( instead of <strong><code>24</code></strong> times for the word <strong><code>free</code></strong> ), the results are very <strong>fast</strong>, in comparison :</p>
<pre><code class="language-diff">                   Search of the literal upper-case word 'COPYING'

Times "License.txt"             Size                  Lines       Hiding lines time
---------------------------------------------------------------------------------------
license.txt × 1000        35,500,000,bytes        231,000 lines         12,5  s
</code></pre>
<p dir="auto">Of course, if I tried to <strong>re-run</strong> the script, <strong>before</strong> getting the <strong>highlighted</strong> line margin, I received the <strong>usual</strong> message :<br />
<strong><code>Another script is currently running. Running two scripts at the same time could produce unpredicable results, and is therefore disabled</code></strong></p>
<p dir="auto">Note that I tested this script with a <strong>portable</strong> N++ <strong><code>v8.4.6</code></strong> version, located on an <strong><code>USB</code></strong> drive</p>
<hr />
<p dir="auto">Now, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26608">@datatraveller1</a>, in order to <em>ONLY</em> copy the <strong>visible</strong> lines, here is a work-around :</p>
<ul>
<li>
<p dir="auto">Run the <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@alan-kilborn</a> Python script <strong>first</strong></p>
</li>
<li>
<p dir="auto">Open the <strong>Mark</strong> dialog ( <strong><code>Crl + M</code></strong> )</p>
</li>
<li>
<p dir="auto">Write the <strong>same</strong> string than in <strong>Alan</strong>’s Python script, in the <strong><code>Find what</code></strong> zone</p>
</li>
<li>
<p dir="auto">Tick the <strong>four</strong> options <strong><code>Bookmark line</code></strong>, <strong><code>Purge for each search</code></strong>, <strong><code>Match case</code></strong> and <strong><code>wrap around</code></strong>, only</p>
</li>
<li>
<p dir="auto">Select the <strong><code>Normal</code></strong> search <strong>mode</strong></p>
</li>
<li>
<p dir="auto">Click on the <strong><code>Mark All</code></strong> button</p>
</li>
<li>
<p dir="auto">Run the <strong><code>Search &gt; Bookmark &gt; Copy Bookmarked Lines</code></strong> option or <strong>right</strong>-click on the <strong>bookmark</strong> margin and choose it</p>
</li>
<li>
<p dir="auto">Open a <strong>new</strong> tab ( <strong><code>Ctrl + N</code></strong> )</p>
</li>
<li>
<p dir="auto"><strong>Paste</strong> the <strong>copied</strong> text ( <strong><code>Ctrl + V</code></strong> )</p>
</li>
</ul>
<hr />
<p dir="auto">Finally, <strong><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@alan-kilborn</a></strong>, <strong><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22926">@paul-wormer</a></strong> and <strong><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26608">@datatraveller1</a></strong>, regarding the <strong>method</strong>, wouldn’t it be better to :</p>
<ul>
<li>
<p dir="auto">Trigger a usual <strong>Mark</strong> action, with the <strong><code>Bookmark line</code></strong> option set</p>
</li>
<li>
<p dir="auto">Elaborate a <strong><code>Python</code></strong> script  which simply would <strong>hide</strong> <em>ALL</em> <strong>non-marked</strong> lines, from the <strong>Mark</strong> results !</p>
</li>
</ul>
<p dir="auto"><strong><code>3</code></strong> <strong>immediate</strong> advantages of this method :</p>
<ul>
<li>
<p dir="auto">You are <strong>not</strong> limited, anymore to a <strong><code>literal</code></strong> string</p>
</li>
<li>
<p dir="auto">You could choose a <strong><code>sensitive</code></strong> or <strong><code>non-insensitive</code></strong> search</p>
</li>
<li>
<p dir="auto">You could choose the search <strong>mode</strong> : <strong><code>Normal</code></strong>, <strong><code>Extended</code></strong> or <strong><code>Regular expresion</code></strong></p>
</li>
</ul>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/82977</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/82977</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Tue, 03 Jan 2023 02:18:09 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Mon, 02 Jan 2023 16:27:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a><br />
I made a small step forward.  After line 170 I modified the code as follows:</p>
<pre><code>
            # hide all lines first:
            self.show_all_lines(False)
            
            import time
            print('sleep ..')
            time.sleep(60)
            
            # show only lines with hits from the search based on user criterion:
            for (pos_start, pos_end) in L:
                editor.setIndicatorCurrent(SCE_UNIVERSAL_FOUND_STYLE)
                editor.indicatorFillRange(pos_start, pos_end - pos_start)
                line_start = editor.lineFromPosition(pos_start)
                line_end = editor.lineFromPosition(pos_end)
                editor.showLines(line_start, line_end)
            
            time.sleep(60)
            print('Woke up')    
</code></pre>
<p dir="auto">The sleep(60) gave me time to look at what’s happening and I noticed that often not all lines are hidden at the first sleep. These lines stay visible after the second sleep. The lines that stay visible are more or less random, so I get the feeling that it is a matter of timing. When I increase the length of the file by adding comments different lines stay visible. Datatraveller1 may well have a faster PC than Alan and me.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/82976</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/82976</guid><dc:creator><![CDATA[Paul Wormer]]></dc:creator><pubDate>Mon, 02 Jan 2023 16:27:15 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Sun, 01 Jan 2023 19:10:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22926">@Paul-Wormer</a> Yes, always correct results.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/82945</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/82945</guid><dc:creator><![CDATA[datatraveller1]]></dc:creator><pubDate>Sun, 01 Jan 2023 19:10:33 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Sun, 01 Jan 2023 14:25:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26608">@datatraveller1</a> Also in a new session? That is, after closing Npp and starting it again?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/82944</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/82944</guid><dc:creator><![CDATA[Paul Wormer]]></dc:creator><pubDate>Sun, 01 Jan 2023 14:25:20 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Sun, 01 Jan 2023 14:21:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22926">@Paul-Wormer</a> I still get always correct results (also after repeating steps 1-3 up to 10 times).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/82943</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/82943</guid><dc:creator><![CDATA[datatraveller1]]></dc:creator><pubDate>Sun, 01 Jan 2023 14:21:37 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Sun, 01 Jan 2023 14:06:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26608">@datatraveller1</a>  I run the script three times in a <strong>new</strong> session:</p>
<ol>
<li>Hide lines not containing the string</li>
<li>Undo it (show all lines again)</li>
<li>Hide lines not containing the string</li>
</ol>
<p dir="auto">Then: step 1 gives too many lines and step 3 is OK.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/82942</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/82942</guid><dc:creator><![CDATA[Paul Wormer]]></dc:creator><pubDate>Sun, 01 Jan 2023 14:06:29 GMT</pubDate></item><item><title><![CDATA[Reply to Show only lines that contain a search term on Sun, 01 Jan 2023 14:00:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/26608">@datatraveller1</a> said in <a href="/post/82939">Show only lines that contain a search term</a>:</p>
<blockquote>
<p dir="auto">I think what I see is the correct result:</p>
</blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a> Do you know why I get the correct result if I filter for <strong>self.settings_by_viewfile_dict</strong> while Paul and you get the wrong result? :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/82941</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/82941</guid><dc:creator><![CDATA[datatraveller1]]></dc:creator><pubDate>Sun, 01 Jan 2023 14:00:04 GMT</pubDate></item></channel></rss>