<?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[Find and Display *All* Duplicate Lines]]></title><description><![CDATA[<p dir="auto">How can I find duplicate lines and display <em>all</em> occurrences of those lines?</p>
<p dir="auto">That is: if I have 2 identical lines, I’d like the <strong>2 occurrences</strong> to be displayed in the Search Results window.</p>
<p dir="auto">The solution provided in <a href="https://community.notepad-plus-plus.org/topic/10601/is-there-a-way-to-search-for-duplicate-records-in-notepad">https://community.notepad-plus-plus.org/topic/10601/is-there-a-way-to-search-for-duplicate-records-in-notepad</a> is very nice, but it shows “number of occurrences - 1”.</p>
<p dir="auto">Thank you.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/25145/find-and-display-all-duplicate-lines</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 01:53:33 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/25145.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 17 Nov 2023 14:17:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Sun, 14 Jan 2024 21:00:16 GMT]]></title><description><![CDATA[<p dir="auto">If you’ve used a script in this thread, you might want to double check your copy of it for a bug I’ve discovered.<br />
Look to previous postings in this topic thread where the script has been changed – find the text <code>moderator edit (2024-Jan-14)</code>.<br />
There’s a link there that describes the bug in more detail, and shows what needs to be changed in an old copy (or you can simply grab a copy of the current version).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/92063</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/92063</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 14 Jan 2024 21:00:16 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Fri, 24 Nov 2023 20:16:43 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> a bit off topic but…<br />
Congratulations on being the top 3 poster now!!!<br />
Thanks for your great contributions to the Notepad++ community.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90768</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90768</guid><dc:creator><![CDATA[datatraveller1]]></dc:creator><pubDate>Fri, 24 Nov 2023 20:16:43 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Thu, 23 Nov 2023 17:38:43 GMT]]></title><description><![CDATA[<p dir="auto">Thank you <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> on the <code>editor.setFirstVisibleLine(line_in_source_file)</code> thing. That works perfectly and now I’m consistently taken a view with the desired line at the top.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@Alan-Kilborn</a>, as the results are now more consistent I spotted a clue related to the random selection.  The end of the random selection is at or very near the mouse which is there because I was double clicking on the line in the <code>DupeLineResults.sr</code> file. The typing cursor is also at that spot.</p>
<p dir="auto">When we double click on a word in npp that word becomes selected. When working with <code>DupeLineResults.sr</code> I double click on a line and am usually double clicking on the number part of <code>Line 1234</code> though I could double click on the word <code>Line</code>. I’m now wondering if npp or Scintilla is still in the middle of painting that double-clicked word in the <code>DupeLineResults.sr</code> tab while the <code>FindAndDisplayAllDuplicateLines.py</code> script is running <code>notepad.activateIndex(view, index)</code></p>
<p dir="auto">I tried an experiment with starting a bunch of CPU bound processes to tie up the machine but was unable to hit the sweet spot of getting random selections to happen every time. I did discover that if I use <code>start /high</code> when starting a CPU bound thread that having all of my CPU cores running high priority threads results badly performing windows. I killed one of those threads to free up a CPU core and both Windows and Notepad++ work very well.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90746</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90746</guid><dc:creator><![CDATA[mkupper]]></dc:creator><pubDate>Thu, 23 Nov 2023 17:38:43 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Thu, 23 Nov 2023 17:18:57 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/90729">Find and Display *All* Duplicate Lines</a>:</p>
<blockquote>
<p dir="auto">But I forgot to specify that your must cancel, as well, the Word wrap feature. That is IMPORTANT !!</p>
</blockquote>
<hr />
<p dir="auto">Do we call this YOUR bug, since you introduced the “setFirstVisibleLine” code? :-)</p>
<hr />
<p dir="auto">I didn’t try it, but probably changing:</p>
<p dir="auto"><code>editor.setFirstVisibleLine(line_in_source_file)</code></p>
<p dir="auto">to</p>
<p dir="auto"><code>editor.setFirstVisibleLine(editor.visibleFromDocLine(line_in_source_file))</code></p>
<p dir="auto">will cure that.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90745</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90745</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 23 Nov 2023 17:18:57 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Thu, 23 Nov 2023 14:10:34 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/90730">Find and Display *All* Duplicate Lines</a>:</p>
<blockquote>
<p dir="auto">If you do get a <code>DupeLineresults.sr</code> file in a tab and that the corresponding source file is presently closed, any double-click on a line of the <code>DupeLineResults.sr</code> file will not open the source file, contrary to a double-click in the Search results panel !</p>
</blockquote>
<p dir="auto">Yes, well a compromise here, because this is only a single source file situation – not multi-file like a potential find-in-files – is that you already have the source file open in another tab.  :-)</p>
<p dir="auto">We can fix it with…more code…  The original intent, like most of my scripts, is just a demo of possible functionality, not all-encompassing behavior.  To try to do that…scripts get too long and the main point is lost, with all the error-checking needed, and the full-featuredness ratcheting up the line count…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90731</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90731</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 23 Nov 2023 14:10:34 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Thu, 23 Nov 2023 13:59:52 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">An other <strong>minor</strong> bug :</p>
<p dir="auto">If you do get a <strong><code>DupeLineresults.sr</code></strong> file  in a tab and that the corresponding <strong>source</strong> file is presently <strong>closed</strong>, any <strong>double</strong>-click on a line of the <strong><code>DupeLineResults.sr</code></strong> file will <strong>not</strong> open the <strong>source</strong> file, contrary to a <strong>double</strong>-click in the <strong><code>Search results</code></strong> panel  !</p>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90730</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90730</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 23 Nov 2023 13:59:52 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Thu, 23 Nov 2023 13:45:01 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/101">@yaron</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/27184">@coises</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/5329">@mkupper</a>, <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">So, as <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@alan-kilborn</a> mentioned, to <strong>always</strong> get the <strong>target</strong> line on <strong>top</strong> of the <strong>visible</strong> screen, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/5329">@mkupper</a>, simply <strong>add</strong> this line :</p>
<pre><code class="language-py">                    editor.setFirstVisibleLine(line_in_source_file) 
</code></pre>
<p dir="auto"><strong>Right after</strong> the line</p>
<pre><code class="language-py">                        editor.gotoLine(line_in_source_file)
</code></pre>
<p dir="auto">But I forgot to specify that your must <strong>cancel</strong>, as well, the <strong><code>Word wrap</code></strong> feature. That is <em>IMPORTANT</em> !!</p>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90729</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90729</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 23 Nov 2023 13:45:01 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Thu, 23 Nov 2023 14:11:15 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/90727">Find and Display *All* Duplicate Lines</a>:</p>
<blockquote>
<p dir="auto">In order to always get the target line on top of the visible screen, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/5329">@mkupper</a>, simply add these 3 Python lines :</p>
<pre><code>                    curr_pos = editor.getCurrentPos()
                    curr_line = editor.lineFromPosition(curr_pos)
                    editor.setFirstVisibleLine(curr_line)
</code></pre>
<p dir="auto">right after the line</p>
<pre><code>                    editor.gotoLine(line_in_source_file)
</code></pre>
</blockquote>
<p dir="auto">You shouldn’t have to calculate new values (your <code>curr_pos</code> and <code>curr_line</code>).</p>
<p dir="auto"><code>editor.setFirstVisibleLine(line_in_source_file)</code> should suffice.</p>
<hr />
<blockquote>
<p dir="auto">to get rid of the random selection issue, I personally solve the problem by moving the <code>DupeLineResults.sr</code> file in the secondary view ! And , in that case, it does not bother anymore about a possible previous selection, in the <code>DupeLineResults.sr</code> file, right before double-clicking to get an other line</p>
</blockquote>
<p dir="auto">I can’t comment, as I can’t reproduce random selections happening.</p>
<hr />
<blockquote>
<p dir="auto">Alan, everything is perfect with your script, by now</p>
</blockquote>
<p dir="auto">Well, I doubt this, given mkupper’s continuing strange issues with it.</p>
<p dir="auto"><strong>EDIT</strong>:  Ah…wait… I may have just had an inspiration on what could be happening for mkupper, even though I can’t repro it.  I’ll do some more thinking on it, and if its logic is sound, I’ll post about it…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90728</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90728</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 23 Nov 2023 14:11:15 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Thu, 23 Nov 2023 12:22:50 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/101">@yaron</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/27184">@coises</a>, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/5329">@mkupper</a>, <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">From this post :</p>
<p dir="auto"><a href="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/14">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/14</a></p>
<p dir="auto">In order to <strong>always</strong> get the <strong>target</strong> line on <strong>top</strong> of the <strong>visible</strong> screen, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/5329">@mkupper</a>, simply add these <strong><code>3</code></strong> <strong>Python</strong> lines :</p>
<pre><code class="language-py">                        curr_pos = editor.getCurrentPos()
                        curr_line = editor.lineFromPosition(curr_pos)
                        editor.setFirstVisibleLine(curr_line)
</code></pre>
<p dir="auto"><strong>right after</strong> the line</p>
<pre><code class="language-py">                        editor.gotoLine(line_in_source_file)
</code></pre>
<p dir="auto">in the <strong><code>FindAndDisplayAllDuplicateLines (FADADL)</code></strong> <strong>Alan</strong> script</p>
<p dir="auto">Just be sure that the parameter <strong><code>Enable scrolling beyond last line</code></strong> is <strong>checked</strong>, in the <strong><code>Preferences &gt; Editing</code></strong> panel</p>
<hr />
<p dir="auto">Now, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/5329">@mkupper</a> and <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/7377">@alan-kilborn</a>, to get rid of the <strong>random selection</strong> issue, I <strong>personally</strong> solve the problem by moving the <strong><code>DupeLineResults.sr</code></strong> file in the <strong>secondary</strong> view ! And , in that case, it does <strong>not</strong> bother anymore about a possible <strong>previous</strong> selection, in the <strong><code>DupeLineResults.sr</code></strong> file, right before <strong>double</strong>-clicking to get an other line ;-)</p>
<p dir="auto">WOW…, <strong>Alan</strong>, everything is <strong>perfect</strong> with your script, by now !!</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90727</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90727</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Thu, 23 Nov 2023 12:22:50 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Thu, 23 Nov 2023 11:46: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> said earlier:</p>
<blockquote>
<p dir="auto">Another reason is that I have a UDL that I made for .sr files which colorizes the output somewhat like N++'s Search results,</p>
</blockquote>
<p dir="auto">Actually, I misspoke.  When I first set it up, I was trying to do it with a UDL, but I later switched to using the <em>EnhanceAnyLexer</em> plugin.  (I was confused because I didn’t delete my UDL when I went a different way)</p>
<p dir="auto"><em>EnhanceAnyLexer</em> seems easier than trying to force N++ to artificially use the internal Search-result lexer, but it is definitely interesting to play around with something like that, so I enjoyed considering the code from <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14847">@Michael-Vincent</a> and <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14479">@Ekopalypse</a> earlier in this thread.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90725</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90725</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 23 Nov 2023 11:46:27 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Thu, 23 Nov 2023 11:28:21 GMT]]></title><description><![CDATA[<p dir="auto">I used my lunch break productively :-)<br />
Please note that this only works if the corresponding search has taken place, i.e.<br />
You cannot save the search result in a file and reapply the styling when loading.</p>
<p dir="auto"><img src="/assets/uploads/files/1700738660624-6376b31b-6cab-4096-a008-6a02e8fc979e-image.png" alt="6376b31b-6cab-4096-a008-6a02e8fc979e-image.png" class=" img-fluid img-markdown" /></p>
<pre><code class="language-py">from ctypes import (cdll, windll, create_string_buffer, create_unicode_buffer,
    addressof, pointer, WINFUNCTYPE)
from ctypes.wintypes import BOOL, HWND, LPARAM, WPARAM, UINT

from Npp import editor2, notepad

SendMessage          = windll.user32.SendMessageW
SendMessage.argtypes = [HWND, UINT, WPARAM, LPARAM]
SendMessage.restype  = LPARAM

NPPM_CREATELEXER = (1024 + 1000 + 110)

WNDENUMPROC = WINFUNCTYPE(BOOL, HWND, LPARAM)

FindWindowEx = windll.user32.FindWindowExW
GetWindowText = windll.user32.GetWindowTextW
GetWindowTextLength = windll.user32.GetWindowTextLengthW
EnumChildWindows = windll.user32.EnumChildWindows
GetClassName = windll.user32.GetClassNameW


nppHandle = notepad.hwnd
curr_class = create_unicode_buffer(256)
WM_CLOSE = 0x010
window_hwnds = {}

SEARCH_WINDOW = 'Search results'

def foreach_window(hwnd, lParam):
    if curr_class[:GetClassName(hwnd, curr_class, 256)] == '#32770':
        length = GetWindowTextLength(hwnd)
        if length &gt; 0:
            buff = create_unicode_buffer(length + 1)
            GetWindowText(hwnd, buff, length + 1)
            if buff.value == SEARCH_WINDOW:
                window_hwnds[buff.value] = hwnd
                return False
    return True

EnumChildWindows(nppHandle, WNDENUMPROC(foreach_window), 0)

if SEARCH_WINDOW in window_hwnds:
    SCI_GETPROPERTY = 4008
    sci_hwnd = FindWindowEx(window_hwnds[SEARCH_WINDOW], None, 'Scintilla', None)

    mark_struct = create_string_buffer(b'@MarkingsStruct')
    mark_struct_ptr = addressof(mark_struct)

    length = SendMessage(sci_hwnd, SCI_GETPROPERTY, mark_struct_ptr, 0)
    buffer = create_string_buffer(length+1)
    SendMessage(sci_hwnd, SCI_GETPROPERTY, mark_struct_ptr, addressof(buffer))

    _lexer = create_unicode_buffer('searchResult')

    ilexer_ptr = SendMessage(notepad.hwnd, NPPM_CREATELEXER, 0, addressof(_lexer))
    editor2.setILexer(ilexer_ptr)
    editor2.setProperty('@MarkingsStruct', buffer.value)
    editor2.styleSetFore(1, (224, 108, 117))
    editor2.styleSetFore(2, (229, 192, 123))
    editor2.styleSetFore(3, (209, 154, 102))
    editor2.styleSetFore(4, (97, 175, 239))
    editor2.colourise(0, -1)

</code></pre>
<p dir="auto">Note the use of editor2!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90724</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90724</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Thu, 23 Nov 2023 11:28:21 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Thu, 23 Nov 2023 08:16:28 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> <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14847">@Michael-Vincent</a></p>
<p dir="auto">Afaik the problem is that the “search result” lexer uses an internal structure <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/ea3afd08c525ae6124d0cce6250e035131b3b646/lexilla/lexers/LexSearchResult.cxx#L117" rel="nofollow ugc">MarkingsStruct</a> that contains the results to which it refers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90722</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90722</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Thu, 23 Nov 2023 08:16:28 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Thu, 23 Nov 2023 02:19:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14847">@Michael-Vincent</a> said in <a href="/post/90685">Find and Display *All* Duplicate Lines</a>:</p>
<blockquote>
<p dir="auto">this lexer name seems to be defined and used within N++, I wonder why PythonScript cannot activate it?</p>
</blockquote>
<p dir="auto">I agree with the sentiment, and a while ago I actually tried go get this going – but not to the level it seems you did.  I was also unsuccessful.  I had some offline chats with <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/14479">@Ekopalypse</a> about it; I don’t think we got to a working solution.  :-(</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90718</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90718</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 23 Nov 2023 02:19:35 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Wed, 22 Nov 2023 21:55:42 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/90708">Find and Display *All* Duplicate Lines</a>:</p>
<blockquote>
<p dir="auto">When typing names of files with two-letter extensions, some extensions map to known TopLevelDomains, which makes NodeBB linkify those filenames as URLs.</p>
</blockquote>
<p dir="auto">I always wondered why it did that – go to know.<br />
In the past I’ve <em>sometimes</em> red-texted the name of scripts, but not always; didn’t realize there was possibly some harm to come from <em>not</em> doing it.<br />
I’ll attempt to remember to do filenames in red-text from now on.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90711</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90711</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 22 Nov 2023 21:55:42 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Wed, 22 Nov 2023 20:55:22 GMT]]></title><description><![CDATA[<p dir="auto">Moderator note: When typing names of files with two-letter extensions, some extensions map to known TopLevelDomains, which makes NodeBB linkify those filenames as URLs.</p>
<p dir="auto">So the “search results” <code>.sr</code> suffix is trying to linkify to domains assigned to Suriname, and <code>.py</code> suffix is trying to linkify domains assigned to Paraguay.  Whether or not those domains actually exist, it’s not a good idea to link to them: spam bots that are crawling the web see links to non-existent domains, and they may try to buy those domains and put nefarious websites behind those links just to get a few more victims.</p>
<p dir="auto">I have <code>red-text</code>ed the links I noticed in this discussion… but when you are previewing your post, if you see something in link color that you don’t expect, please go back and <code>red-text</code>ify it, so that I don’t have to.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90708</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90708</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 22 Nov 2023 20:55:22 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Wed, 22 Nov 2023 20:49:14 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/90703">Find and Display *All* Duplicate Lines</a>:</p>
<blockquote>
<p dir="auto">The problem you are experiencing seems to go deeper than this, but I will say that there isn’t a guarantee as to where in the viewport a line that you are moving to will appear.</p>
<p dir="auto">Scintilla documentation for .gotoLine for example, says, “…scrolls the view (if needed) to make it (the line) visible”.</p>
</blockquote>
<p dir="auto">I agree that the problem I’m experiencing is odd. I was thinking about what the <code>FindAndDisplayAllDuplicateLines.py</code> script could be racing with and so disabled TextFX which I found I had finally weeded myself from using. That did not help the selection issue.</p>
<p dir="auto">I tried to detect a pattern of the top or bottom of the viewport and did not see one while also getting intermittent selections. My current installation of Notepad++ seems to be nearly bare-bones. I think the only non-default plugin is PythonScript.</p>
<p dir="auto">The next step for me is to set up a fresh portable installation.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90706</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90706</guid><dc:creator><![CDATA[mkupper]]></dc:creator><pubDate>Wed, 22 Nov 2023 20:49:14 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Wed, 22 Nov 2023 19:21:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/5329">@mkupper</a> said in <a href="/post/90701">Find and Display *All* Duplicate Lines</a>:</p>
<blockquote>
<p dir="auto">sometimes it’s top line that is visible, and sometimes the target line is at the at the bottom of the visible page</p>
</blockquote>
<p dir="auto">The problem you are experiencing seems to go deeper than this, but I will say that there isn’t a guarantee as to where in the viewport a line that you are moving to will appear.</p>
<p dir="auto">Scintilla documentation for <code>.gotoLine</code> for example, says, “…scrolls the view (if needed) to make it (the line) visible”.</p>
<p dir="auto">Programmers can pull extra duty to ensure that a line appears in the viewport where they want it to; example <a href="https://community.notepad-plus-plus.org/topic/20370">HERE</a>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90703</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90703</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 22 Nov 2023 19:21:42 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Wed, 22 Nov 2023 19:24:26 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/90684">Find and Display *All* Duplicate Lines</a>:</p>
<blockquote>
<p dir="auto">Is it only a “random selection” issue? That is, if you pretend the selection isn’t there, does your caret (at one end of the selection) end up on the correct line? If that’s the case, maybe we can simply cancel the selection.</p>
</blockquote>
<p dir="auto">When a selection happens I am taken to the middle of a page with the selection ending at the line I’m on. The intended target line is on the page, sometimes it’s top line that is visible, and sometimes the target line is at the at the bottom of the visible page.</p>
<p dir="auto">This item is unrelated to the random selection issue. I don’t know if it’s by design but sometimes double clicking takes me to a page with the target line at the very top and other times the target is at the very bottom of the selected page.  This slows me down because after double clicking I need to then visually find the newly selected line. The choice of top or bottom seems random, even when retesting a line such as 6208.</p>
<p dir="auto">I now have two workarounds as I understand better what is happening with the random top/bottom combined with the intermittent appearance of a selection. When I get a selection I can go back to <code>DupeLineResults.sr</code> and double click again. The odds are it will work.</p>
<p dir="auto">Another workaround is to be mindful of the line number I intend to go to when double clicking in <code>DupeLineResults.sr</code>. If I get a selection then I know the line I want is either the first  or last line on the page and so can look for it and move there without needing to re-run the double-click.</p>
<p dir="auto">The glitch is intermittent and can’t be solved by just cancelling the selection.  However, a possible workaround in the code is to fetch the current line number. If you are not on the expected line then cancel the selection and re-run going to the target line.</p>
<p dir="auto">When I double click in <code>DupeLineResults.sr</code> I’m seeing that one of three things will happen:</p>
<ol>
<li>I am taken to the selected line which is positioned at the top of the page.</li>
<li>I am taken to the selected line which is positioned at the bottom of the page. This seems to happen more often than being taken to the top of the page.</li>
<li>I am taken to the middle of a page though trending towards the upper half and will have a selection running from the top of the page to my spot in the middle. The intended target line has always been either the first or last visible line on the page. The selection has always started far up the file and tends to be near the top.</li>
</ol>
<p dir="auto">I don’t know if it matters but I run Notepad++ (and all apps) in full screen mode and have a single monitor. It lets me focus on what I’m working on. My fingers are well versed in the keystrokes needed to navigate among tabs of those apps that have tabs and are well versed in Alt-Tabbing to other apps.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90701</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90701</guid><dc:creator><![CDATA[mkupper]]></dc:creator><pubDate>Wed, 22 Nov 2023 19:24:26 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Wed, 22 Nov 2023 13:48:13 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/90650">Find and Display *All* Duplicate Lines</a>:</p>
<blockquote>
<p dir="auto">output file has a .sr extension. The sr stands for “search results”; I tried to emulate Notepad++'s Search results format in the output I created.</p>
<p dir="auto">Another reason is that I have a UDL that I made for .sr files which colorizes the output</p>
</blockquote>
<p dir="auto">A bit off topic for this current discussion, but Notepad++ has a “lexer” for “Internal Search” called “searchResult” that has entries in both ‘langs.model.xml’ and ‘stylers.model.xml’.  You can see it in:</p>
<p dir="auto"><a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/97dd708e233559a4a0bd819f7ee72892c27e1a66/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp#L116" rel="nofollow ugc">https://github.com/notepad-plus-plus/notepad-plus-plus/blob/97dd708e233559a4a0bd819f7ee72892c27e1a66/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp#L116</a></p>
<p dir="auto">The “lexer” is set here:</p>
<pre><code class="language-C++">notepad-plus-plus/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp:
640: 	if (_scintView.execute(SCI_GETLEXER) == SCLEX_NULL)
641: 	{
642: 		_scintView.setLexer(L_SEARCHRESULT, LIST_NONE); // Restore searchResult lexer in case the lexer was changed to SCLEX_NULL in GotoFoundLine()
643: 	}
</code></pre>
<p dir="auto">which through <code>setLexer()</code> eventually calls:</p>
<pre><code class="language-C++">notepad-plus-plus/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp:
2165: bool ScintillaEditView::setLexerFromLangID(int langID) // Internal lexer only
2166: {
2167: 	if (langID &gt;= L_EXTERNAL)
2168: 		return false;
2169: 
2170: 	const char* lexerNameID = _langNameInfoArray[langID]._lexerID;
2171: 	execute(SCI_SETILEXER, 0, reinterpret_cast&lt;LPARAM&gt;(CreateLexer(lexerNameID)));
2172: 	return true;
2173: }
</code></pre>
<p dir="auto">That functionality can be “duplicated” in PythonScript and in fact I have a “hidder Lexer” script based on work from <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@PeterJones</a> and others that can enable some of Lexilla’s lexers that N++ does not expose.  I’m wondering why we can’t just:</p>
<pre><code class="language-Python">from ctypes import windll, addressof, create_unicode_buffer
from ctypes.wintypes import HWND, UINT, WPARAM, LPARAM

from Npp import editor, notepad

SendMessage          = windll.user32.SendMessageW;
SendMessage.argtypes = [HWND, UINT, WPARAM, LPARAM]
SendMessage.restype  = LPARAM

NPPM_CREATELEXER = (1024 + 1000 + 110)

_lexer     = create_unicode_buffer('searchResult')

ilexer_ptr = SendMessage(notepad.hwnd, NPPM_CREATELEXER, 0, addressof(_lexer))
editor.setILexer(ilexer_ptr)

editor.colourise(0, -1)
</code></pre>
<p dir="auto">which (I hope) is the smallest self-contained example of what my hidder Lexer script does.  I tried this but it does not lex the document as “searchResult” or “Internal Search”.  I’m sure it’s a bit different in that I’m not trying to activate a Lexilla lexer, but this lexer name seems to be defined and used within N++, I wonder why PythonScript cannot activate it?</p>
<p dir="auto">Cheers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90685</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90685</guid><dc:creator><![CDATA[Michael Vincent]]></dc:creator><pubDate>Wed, 22 Nov 2023 13:48:13 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Wed, 22 Nov 2023 12:18:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/5329">@mkupper</a> said in <a href="/post/90665">Find and Display *All* Duplicate Lines</a>:</p>
<blockquote>
<p dir="auto">I’m still getting and puzzling over the random selections issue.</p>
</blockquote>
<p dir="auto">Is it <em>only</em> a “random selection” issue?  That is, if you pretend the selection isn’t there, does your caret (at one end of the selection) end up on the correct line?  If that’s the case, maybe we can simply cancel the selection.</p>
<p dir="auto">It seems maybe there is something of a race going on here.  The double-click makes Scintilla want to do something in the current (results) file – it wants to select a double-clicked word – but maybe that processing is somehow delayed until the source file is activated, and then bogus positions are used as Scintilla finishes making its selection?  This goes against my understanding of how it <em>should</em> work but…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90684</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90684</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 22 Nov 2023 12:18:29 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Tue, 21 Nov 2023 19:06:13 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> and <strong>All</strong>,</p>
<p dir="auto">Oh…yes. Alan, I am unforgivable and <strong>deeply</strong> sorry ! Of course, everything worked <strong>fine</strong> after I stopped and restarted Notepad++. ;-))</p>
<p dir="auto">Just a lesson : No good to be too <strong>lazy</strong>. Things must be run on the <strong>right</strong> order !</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S</strong>. :</p>
<p dir="auto">Finally, I understand your <strong>design</strong> decision… once you’re <strong>no longer</strong> surprised to see <strong>several</strong> sets that seem to concern <strong>only</strong> one set !</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90666</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90666</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Tue, 21 Nov 2023 19:06:13 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Tue, 21 Nov 2023 18:21:57 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 others.</p>
<p dir="auto">I’m still getting and puzzling over the random selections issue. I don’t have any selections active and so for now have been trimming my test file down. At present it’s 787 lines of plain ASCII with no line longer than 100 characters.</p>
<p dir="auto">As you and others are not seeing the issue with larger files I’m going to change tactics and set up a bare bones portable v8.6 x32.  My day to day installed copy of Notepad++ has cruft from many years of upgrading and is also x32 for compatibility with a couple of obsolete plugins. It’s using PythonScript version 2 which I assume is still available.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90665</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90665</guid><dc:creator><![CDATA[mkupper]]></dc:creator><pubDate>Tue, 21 Nov 2023 18:21:57 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Tue, 21 Nov 2023 18:19:59 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/90663">Find and Display *All* Duplicate Lines</a>:</p>
<blockquote>
<p dir="auto">but the two modifications fail</p>
</blockquote>
<p dir="auto">Did you restart Notepad++ after making the modifications?</p>
<hr />
<p dir="auto">BTW, these lines control that:</p>
<pre><code class="language-py">if __name__ == '__main__':
    try:
        fadadl
    except NameError:
        fadadl = FADADL()
    fadadl.run()
</code></pre>
<p dir="auto">The <em>first</em> time the script is run during a Notepad++ invocation (don’t want to use the word “session” here), <code>fadadl</code> doesn’t exist, so the NameError happens and the <code>fadadl = FADADL()</code> line executes (key part: registering the callback), and then the <code>run</code> method is called.</p>
<p dir="auto">Because the callback is already there the <em>second</em> and later times the script is executed, the <code>fadadl = FADADL()</code> line does NOT execute; we don’t want multiple copies of the callback (otherwise a double-click on a <code>Line x</code> line would run the same callback code two or even more times).  Thus any changes you’ve made to the code do not get picked up, and only the <code>run</code> method is called (with the code that was in place during the <em>first</em> execution).</p>
<p dir="auto">There are other ways to accomplish these goals, but I’ve never fully trusted trying to remove an existing callback.  I consider needing to restart Notepad++ a small limitation, because most users would just use the script, not modify it.</p>
<p dir="auto">I hope this makes sense.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90664</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90664</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 21 Nov 2023 18:19:59 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Display *All* Duplicate Lines on Tue, 21 Nov 2023 16:56:58 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">Sorry, <strong>Alan</strong>, but the <strong>two</strong> modifications fail :-((</p>
<hr />
<p dir="auto">Whatever the choice, I get the message :</p>
<pre><code class="language-diff">Traceback (most recent call last):
  File "D:\@@\792\plugins\Config\PythonScript\scripts\Test_Alan.py", line 89, in doubleclick_callback
    if m:
AttributeError: 'NoneType' object has no attribute 'group'
</code></pre>
<p dir="auto">BTW, don’t rely, on the <strong>line number</strong> as I added some <strong>comments</strong> at the beginning of script</p>
<hr />
<p dir="auto">Deleting the <strong><code>.lstrip()</code></strong> string leave the lines <strong><code>Set-### text: ........</code></strong> as they were before, <strong>without</strong> any change !</p>
<p dir="auto">BR</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/90663</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/90663</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Tue, 21 Nov 2023 16:56:58 GMT</pubDate></item></channel></rss>