<?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 Add To Selection In 7.7]]></title><description><![CDATA[<p dir="auto">One of the features I’ve been anxiously awaiting in the next Scintilla update was being able to ‘find’ something, and then finding again so I could get several occurrences in a multi-select status. I downloaded the minimalist version of 7.7 but there’s nothing in the edit or find menu that exposes that capability and I don’t see anything in the shortcut mapper list either. Am I not seeing something? Is this possible with a python script now? I think the Scintilla command I’m looking for is <a href="https://www.scintilla.org/CommandValues.html" rel="nofollow ugc">IDM_SELECTIONADDNEXT or 2688</a>. Cntrl-Shift-D is the default key combo in SciTe that I’m trying to get in NPP. I’ve used <a class="plugin-mentions-user plugin-mentions-a" href="/user/claudia-frank" aria-label="Profile: Claudia-Frank">@<bdi>Claudia-Frank</bdi></a> 's script from <a href="https://notepad-plus-plus.org/community/topic/11360/multi-selection-and-multi-edit" rel="nofollow ugc">here</a> but I was hoping to easily go one ‘find’ at a time w/o the dialog.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/17670/find-and-add-to-selection-in-7-7</link><generator>RSS for Node</generator><lastBuildDate>Fri, 07 Aug 2026 11:34:22 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/17670.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 21 May 2019 00:08:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Mon, 03 Jun 2019 22:30:58 GMT]]></title><description><![CDATA[<p dir="auto">Besides enabling <strong>Multi-Editing</strong> (as explained by <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> in <a href="https://notepad-plus-plus.org/community/topic/17670/find-and-add-to-selection-in-7-7/34" rel="nofollow ugc">his comment</a>), I just had to call the functions directly, just like <a href="https://www.scintilla.org/ScintillaDoc.html#SCI_MULTIPLESELECTADDEACH" rel="nofollow ugc"><strong>Scintilla documentation</strong></a> specifies:</p>
<ul>
<li>
<p dir="auto"><strong><code>SCI_MULTIPLESELECTADDNEXT</code></strong> adds the next occurrence of the main selection within the target to the set of selections as main. If the current selection is empty then select word around caret.</p>
</li>
<li>
<p dir="auto"><strong><code>SCI_MULTIPLESELECTADDEACH</code></strong> is similar to <code>SCI_MULTIPLESELECTADDNEXT</code> but adds multiple occurrences instead of just one.</p>
</li>
</ul>
<p dir="auto">For me, it was unnecessary to call <code>SCI_TARGETWHOLEDOCUMENT</code>, so, for selecting all instances of the word at once, you could just call <code>SCI_MULTIPLESELECTADDNEXT</code> followed by <code>SCI_MULTIPLESELECTADDEACH</code>:</p>
<pre><code>// selects all instances of the selected word (or the word around the caret)
sci_sendmsg 2688 // SCI_MULTIPLESELECTADDNEXT
sci_sendmsg 2689 // SCI_MULTIPLESELECTADDEACH
</code></pre>
<p dir="auto">…which has the same effect of simply calling <code>SCI_MULTIPLESELECTADDEACH</code> twice:</p>
<pre><code>// selects all instances of the selected word (or the word around the caret)
sci_sendmsg 2689 // SCI_MULTIPLESELECTADDEACH
sci_sendmsg 2689 // SCI_MULTIPLESELECTADDEACH
</code></pre>
<p dir="auto">Or, instead of blindly calling it twice, you could check if something is already selected with <code>SCI_GETSELECTIONEMPTY</code> (as used on other comments) and then call it only once:</p>
<pre><code>// selects all instances of the selected word (or the word around the caret)
sci_sendmsg SCI_GETSELECTIONEMPTY
if $(MSG_RESULT) == 1 then
  sci_sendmsg 2688 // SCI_MULTIPLESELECTADDNEXT
endif

sci_sendmsg 2689 // SCI_MULTIPLESELECTADDEACH
</code></pre>
<p dir="auto"><strong>PS:</strong> It would be really nice to have both commands (<code>SCI_MULTIPLESELECTADDNEXT</code> and <code>SCI_MULTIPLESELECTADDEACH</code>) available for hotkeys in “Settings” &gt; “Shortcut Mapper” &gt; “Scintilla commands”.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/44171</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44171</guid><dc:creator><![CDATA[AndreCunha]]></dc:creator><pubDate>Mon, 03 Jun 2019 22:30:58 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Thu, 23 May 2019 16:29:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> , you got it in one. Who would have thought you’d have to enable multi-edit to multi-edit…  NppExec script is working on my 7.7 test install. Thanks again.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43753</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43753</guid><dc:creator><![CDATA[cipher-1024]]></dc:creator><pubDate>Thu, 23 May 2019 16:29:37 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Thu, 23 May 2019 13:02:19 GMT]]></title><description><![CDATA[<p dir="auto">…and I guess for the same reason the Pythonscript presented earlier could benefit from the addition near the top of:</p>
<p dir="auto"><code>editor.setMultipleSelection(True)  # in case not enabled in the Preferences</code></p>
]]></description><link>https://community.notepad-plus-plus.org/post/43737</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43737</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 23 May 2019 13:02:19 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Thu, 23 May 2019 12:55:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/cipher-1024" aria-label="Profile: cipher-1024">@<bdi>cipher-1024</bdi></a> said:</p>
<blockquote>
<p dir="auto">I tried installing NppExec on the 7.7 minimalist install…and trying out the script…but it would only select the current word and never go into multiedit mode</p>
</blockquote>
<p dir="auto">Multi-editing is disabled in a clean install or a portable install:</p>
<p dir="auto"><img src="https://i.imgur.com/eNE2dlF.png" alt="Imgur" class=" img-fluid img-markdown" /></p>
<p dir="auto">Did you go into the preferences and enable it like this?:</p>
<p dir="auto"><img src="https://i.imgur.com/La0RdHD.png" alt="Imgur" class=" img-fluid img-markdown" /></p>
<p dir="auto">Alternatively, this can be added at the top of the NppExec script, to turn multi-selection ability ON:</p>
<p dir="auto"><code>sci_sendmsg 2563 1</code></p>
<p dir="auto">Here’s where the 2563 comes from, in the Scintilla <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/scintilla/include/Scintilla.iface" rel="nofollow ugc">interface</a> file:</p>
<pre><code class="language-z"># Set whether multiple selections can be made
set void SetMultipleSelection=2563(bool multipleSelection,)
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/43736</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43736</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 23 May 2019 12:55:46 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Thu, 23 May 2019 07:57:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/cipher-1024" aria-label="Profile: cipher-1024">@<bdi>cipher-1024</bdi></a> said:</p>
<blockquote>
<p dir="auto">trying out <a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a> 's script but it would only select the current word and never go into multiedit mode.</p>
</blockquote>
<p dir="auto">I guess you only tried the first or second version of the script. The final one and the shortened version of <a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a> some postings above should work.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43728</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43728</guid><dc:creator><![CDATA[dinkumoil]]></dc:creator><pubDate>Thu, 23 May 2019 07:57:29 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Thu, 23 May 2019 01:29:01 GMT]]></title><description><![CDATA[<p dir="auto">I thought this was a three post thread and then it was done! NPP Community delivers! I wound up putting <a class="plugin-mentions-user plugin-mentions-a" href="/user/dail" aria-label="Profile: dail">@<bdi>dail</bdi></a> 's LuaScript into the startup script for the Lua plugin and it’s working great.</p>
<p dir="auto">Out of curiosity I tried installing NppExec on the 7.7 minimalist install and trying out <a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a> 's script but it would only select the current word and never go into multiedit mode. (7.7 32bit, NppExec 0.6RC3). There are no errors in the console. I don’t know if the minimalist version and my older, installed version are conflicting in some way, but I couldn’t get the script to work.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> , thanks for the python script, unfortunately I’m still on 1.0.8 so I haven’t tried it out yet. But once I’m back to being current, I will.</p>
<p dir="auto">My job is being inconvenient and making me do stuff, so I need to sit tight on upgrading for a bit until I have time to iron out any old plugin issues that I may run into after the upgrading. Thank you one and all. This is a great community.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43722</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43722</guid><dc:creator><![CDATA[cipher-1024]]></dc:creator><pubDate>Thu, 23 May 2019 01:29:01 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Wed, 22 May 2019 20:16:28 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">I admit that my <strong>enthusiasm</strong> is a bit excessive ! Just because I’m rather an <strong>old</strong> guy, which knew <strong><code>MS-DOS 5.0</code></strong>, <strong><code>WinWord 6</code></strong> and <strong><code>Excel 5</code></strong> and, even, some <strong>older</strong> goodies. So, I’m a little <strong>overwhelmed</strong> to see all these new <strong>powerful</strong> features ;-))</p>
<p dir="auto">By the way, I’m no longer surprised to create <strong>rectangular</strong> selections, over, let say,  <strong><code>50,000</code></strong> lines , with N++, for years now ! Quite <strong>similar</strong>, except that all the cursors are <strong>aligned</strong> ;-))</p>
<p dir="auto">Cheers,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43713</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43713</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 22 May 2019 20:16:28 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Wed, 22 May 2019 17:43:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a></p>
<p dir="auto">aahhhhh - I constantly forget about using it.  :-)<br />
Yes, it works without but as the syntax defines it, it should be used, imho.<br />
Who knows what a future update will do.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43711</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43711</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Wed, 22 May 2019 17:43:37 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Wed, 22 May 2019 17:40:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a> said:</p>
<blockquote>
<p dir="auto">What do you think?</p>
</blockquote>
<p dir="auto">Except the missing <code>endif</code> ;) - nice catch, it works!</p>
<p dir="auto">Seems like <code>SCI_MULTIPLESELECTADDEACH</code> needs an active selection and <code>SCI_MULTIPLESELECTADDNEXT</code> doesn’t.</p>
<p dir="auto">EDIT: Seems like even the <code>endif</code> is not necessary, I apologize. ;)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43710</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43710</guid><dc:creator><![CDATA[dinkumoil]]></dc:creator><pubDate>Wed, 22 May 2019 17:40:39 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Wed, 22 May 2019 15:33:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a> - I guess your nppexec script can be reduced to this</p>
<pre><code>sci_sendmsg SCI_SETSEARCHFLAGS SCFIND_WHOLEWORD
sci_sendmsg 2690  // SCI_TARGETWHOLEDOCUMENT

sci_sendmsg SCI_GETSELECTIONEMPTY
if $(MSG_RESULT) == 1 then
  sci_sendmsg 2688  // SCI_MULTIPLESELECTADDNEXT
 
sci_sendmsg 2689  // SCI_MULTIPLESELECTADDEACH
</code></pre>
<p dir="auto">What do you think?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43699</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43699</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Wed, 22 May 2019 15:33:39 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Wed, 22 May 2019 13:01:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a> said:</p>
<blockquote>
<p dir="auto">This is multi-selection !!!</p>
</blockquote>
<p dir="auto">Yes.  But maybe I am not understanding the fascination.  As the OP mentioned in the first posting in this thread, there’s been “workaround” ways (see the link in that first posting) to achieve this type of multiselection for a long time…and all of the above in THIS thread is still workaround.</p>
<p dir="auto">What is really needed to make this complete is a good interface within Notepad++ itself (no scripting plugins).  Then, when someone posts to the Community “I can match the text I need by doing a regex-find, but how can I copy that text to a new document?”, we can finally give them a good answer.  And by good I mean one that doesn’t start out with “Install a scripting plugin…”.  Not that there’s anything wrong with scripting plugins, but it is just too cumbersome for someone that has a single need.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43686</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43686</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 22 May 2019 13:01:59 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Wed, 22 May 2019 11:38:38 GMT]]></title><description><![CDATA[<p dir="auto">Hi, <a class="plugin-mentions-user plugin-mentions-a" href="/user/cipher-1024" aria-label="Profile: cipher-1024">@<bdi>cipher-1024</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">As <a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a> and, probably, most of you, I’ve just studied the <strong>two</strong> new <strong>Scintilla</strong> commands <strong><code>SCI_MULTIPLESELECTADDNEXT</code></strong> and <strong><code>SCI_MULTIPLESELECTADDEACH</code></strong> ! Really <strong>impressive</strong> ;-))</p>
<ul>
<li>
<p dir="auto">Install, of course, the last <strong><code>v0.9 (32 bits )</code></strong> version  of <strong>LuaScript</strong>, on the last <strong><code>v7.7</code></strong> version of N++</p>
</li>
<li>
<p dir="auto">Modify, like me, the <strong><code>startup.lua</code></strong> file, as below :</p>
</li>
</ul>
<pre><code class="language-mm">-- Startup script
-- Changes will take effect once Notepad++ is restarted

npp.AddShortcut("Selection Add Next", "Ctrl+F12", function()
    editor:MultipleSelectAddNext()
end)

npp.AddShortcut("Selection Add Each", "Shift+Ctrl+F12", function()
    editor:MultipleSelectAddEach()
end)

-- And affected the 'ALT + F12' shortcut to the 'Plugins &gt; LuaScript &gt; Execute Current File' option
--                   ---------                   ------------------------------------------
</code></pre>
<ul>
<li>
<p dir="auto">Affect, as noticed, the <strong><code>Alt + F12</code></strong> shortcut to the menu command <strong><code>Plugins &gt; LuaScript &gt; Execute Current File</code></strong></p>
</li>
<li>
<p dir="auto">Then, paste this simple <strong>Lua</strong> file, below, in a <strong>new</strong> tab</p>
</li>
</ul>
<pre><code>--&lsqb;&lsqb;  TEST part

TEST
test
T.*T
t.*t
123T.*T456
123 T.*T 456
123t.*t456
123 t.*t 456
123TEST
123test
123 TEST
123 test
TEST456
test456
TEST 456
test 456
123TEST456
123test456
123 TEST 456
123 test 456

&rsqb;&rsqb;

--&lsqb;&lsqb;  FLAGS definition :

Command :  editor.SearchFlags = SCFIND_WHOLEWORD  ( or = 2 )
command :  editor.SearchFlags = SCFIND_MATCHCASE  ( or = 4 )
command :  editor.SearchFlags = SCFIND_WORDSTART  ( or = 2^20 )
command :  editor.SearchFlags = SCFIND_REGEXP     ( or = 2^21 )

Examples :

editor.SearchFlags = 0                                =&gt; Mode NORMAL WITHOUT options 'Match case' and 'Whole word only'
editor.SearchFlags = SCFIND_REGEXP | SCFIND_MATCHCASE =&gt; Mode 'REGULAR expression' with option 'Match case'
editor.SearchFlags = 4 | 2                            =&gt; Mode NORMAL with options 'Match case' and 'Whole word only'
editor.SearchFlags = SCFIND_WORDSTART                 =&gt; Mode NORMAL with option 'Not preceded with a WORD char.'
&rsqb;&rsqb;

-- editor.SearchFlags = SCFIND_REGEXP | SCFIND_MATCHCASE
-- editor.SearchFlags = 4 | 2
-- editor.SearchFlags = 0

--&lsqb;&lsqb;   TARGET definition :

Command    :  editor:SetTargetRange(Offset start, Offset end) - The Go to... command ( Ctrl +G ), with
                                                                  the 'Offset' option, may help !

or command :  editor:TargetFromSelection()                    - Do a NORMAL MAIN selection, in this SCRIPT file
                                                              - Run 'editor:TargetFromSelection()' on Lua CONSOLE
															  - Then, execute this Lua SCRIPT file

or command :  editor:TargetWholeDocument()                    - Self-explanatory
&rsqb;&rsqb;

-- editor:TargetWholeDocument()
-- editor:SetTargetRange(69, 140)  -- TARGET, from START of line 9 to END of line 15


-- And... execute the MAGIC command !

editor:MultipleSelectAddEach()

-- LAST TeSt line
</code></pre>
<ul>
<li>Save it with name <strong><code>Test.lua</code></strong></li>
</ul>
<p dir="auto">As you can see, the only <strong>uncommented</strong> command is <strong><code>editor:MultipleSelectAddEach()</code></strong></p>
<ul>
<li>
<p dir="auto">Now <strong>re-start</strong> N++ and re-open this <strong><code>Test.lua</code></strong>, if necessary</p>
</li>
<li>
<p dir="auto">Unset the <strong>Word wrap</strong> feature ( <strong><code>View &gt; Word wrap</code></strong> )</p>
</li>
<li>
<p dir="auto">Zoom <strong>out</strong> till the <strong>maximum</strong> ( <strong><code>Ctrl + Num+</code></strong> )</p>
</li>
<li>
<p dir="auto">Click on the <strong>vertical</strong> bar to scroll <strong>down</strong>, in order that the line <strong><code>8</code></strong> is on <strong>top</strong> of the windows text</p>
</li>
</ul>
<p dir="auto">=&gt; So, you should see, approximatively, from line <strong><code>8</code></strong> to line <strong><code>21</code></strong> ( with the default <strong><code>Courier New</code></strong> font )</p>
<ul>
<li>
<p dir="auto">Now, do a <strong>normal selection</strong> of the string <strong><code>t.*t</code></strong>, on line <strong><code>10</code></strong></p>
</li>
<li>
<p dir="auto">Finally, run the command <strong><code>Plugins &gt; LuaScript &gt; Execute Current File</code></strong> or hit on <strong><code>Alt + F12</code></strong> ( my shortcut )</p>
</li>
</ul>
<p dir="auto">=&gt; You should see that the word <strong>test</strong> in <strong>any</strong> case, as well as the forms <strong><code>T.*T</code></strong> and <strong><code>t.*t</code></strong> are selected from line <strong><code>8</code></strong> till line <strong><code>20</code></strong>, only, as well as <strong><code>13</code></strong> cursors appear, on the right of <strong>each</strong> selection !</p>
<p dir="auto">This means that, by <strong>default</strong>, if, either, <strong>NO</strong> flags were <strong>previously</strong> set and <strong>NO</strong> target was <strong>previously</strong> defined, the <strong>lua</strong> command <strong><code>editor:MultipleSelectAddEach()</code></strong> seems to select <strong>all</strong> matches of the string <strong><code>t.*t</code></strong>, in <strong>regular</strong> expression mode, without the <strong><code>Match case</code></strong> and <strong><code>Match whole word only</code></strong> options, in <strong>all</strong> the <strong>visible</strong> lines of the <strong>current</strong> screen !?</p>
<hr />
<p dir="auto">Of course, if you <strong>uncomment</strong> the line <strong><code>editor:TargetWholeDocument()</code></strong> and redo the <strong>same</strong> actions as above, ending with the <strong><code>Plugins &gt; LuaScript &gt; Execute Current File</code></strong> command, this time, a <strong>lot</strong> of selections, matching the <strong>regex</strong> criteria <strong><code>t.*t</code></strong>, have appeared, in the <strong>whole</strong> document</p>
<p dir="auto">=&gt; It’s easy to see that the search is performed in a <strong>regex</strong> way as many lines, <strong>outside</strong> the <strong>test</strong> zone, with <strong>variable</strong> length, have been also selected !</p>
<hr />
<p dir="auto">Now :</p>
<ul>
<li>
<p dir="auto"><strong>Comment</strong>, again, the <strong><code>editor:TargetWholeDocument()</code></strong> line</p>
</li>
<li>
<p dir="auto"><strong>Uncomment</strong> the line <strong><code>editor:SetTargetRange(69, 140)  -- TARGET, from START of line 9 to END of line 15</code></strong></p>
</li>
<li>
<p dir="auto">Zoom <strong>out</strong> till the <strong>maximum</strong> ( <strong><code>Ctrl + Num+</code></strong> )</p>
</li>
<li>
<p dir="auto">Select the string <strong><code>t.*t</code></strong>, in line <strong><code>10</code></strong></p>
</li>
<li>
<p dir="auto">Click on the <strong>vertical</strong> bar to scroll <strong>down</strong> till the <strong>end</strong> of the script</p>
</li>
<li>
<p dir="auto">Run the command <strong><code>Plugins &gt; LuaScript &gt; Execute Current File</code></strong></p>
</li>
</ul>
<p dir="auto">=&gt; This time, you should see the line <strong><code>9</code></strong> on <strong>top</strong> of the view and, both, the <strong><code>t.*t</code></strong> and <strong><code>test</code></strong>, in <strong>any</strong> case, selected from line <strong><code>9</code></strong> to line <strong><code>15</code></strong></p>
<p dir="auto"><strong>Note</strong> : for the <strong><code>editor:TargetFromSelection()</code></strong> command, refer to the explanations in <strong>comments</strong> !</p>
<hr />
<p dir="auto">Now :</p>
<ul>
<li>
<p dir="auto"><strong>Comment</strong> the line <strong><code>editor:SetTargetRange(69, 140)  -- TARGET, from START of line 9 to END of line 15</code></strong></p>
</li>
<li>
<p dir="auto"><strong>Uncomment</strong> the <strong><code>editor:TargetWholeDocument()</code></strong> line</p>
</li>
<li>
<p dir="auto"><strong>Uncomment</strong> the <strong><code>editor.SearchFlags = 0</code></strong> line</p>
</li>
<li>
<p dir="auto">Select the string <strong><code>t.*t</code></strong>, in line <strong><code>10</code></strong></p>
</li>
<li>
<p dir="auto">Run the command <strong><code>Plugins &gt; LuaScript &gt; Execute Current File</code></strong></p>
</li>
</ul>
<p dir="auto">=&gt; This time, the ranges, matching the <strong>string</strong> <strong><code>t.*t</code></strong>, in <strong>any</strong> case, are selected, <strong>only</strong>, ( from lines <strong><code>5</code></strong> to <strong><code>10</code></strong> ) <strong>Logic</strong>, as the search is perfomed in a <strong>normal insensitive</strong> way !</p>
<hr />
<p dir="auto">Then :</p>
<ul>
<li>
<p dir="auto">Move the cursor at <strong>beginning</strong> of line 17, <strong>without</strong> selecting anything</p>
</li>
<li>
<p dir="auto">Run the command <strong><code>Plugins &gt; LuaScript &gt; Execute Current File</code></strong></p>
</li>
</ul>
<p dir="auto">=&gt; The word <strong>TEST</strong> is now <strong>selected</strong></p>
<ul>
<li>Run, again, the <strong>same</strong> command <strong><code>Plugins &gt; LuaScript &gt; Execute Current File</code></strong></li>
</ul>
<p dir="auto">=&gt; As expected, this time, all the words <strong><code>TEST</code></strong>, in <strong>any</strong> case, are <strong>selected</strong>, included the <strong>last</strong> line, with word <strong>TeSt</strong></p>
<hr />
<p dir="auto">Now :</p>
<ul>
<li>
<p dir="auto"><strong>Comment</strong> the <strong><code>editor.SearchFlags = 0</code></strong> line</p>
</li>
<li>
<p dir="auto"><strong>Uncomment</strong> the <strong><code>editor.SearchFlags = 4 | 2 ...........</code></strong></p>
</li>
<li>
<p dir="auto"><strong>Double</strong>-click on the word <strong><code>test</code></strong>, in line <strong><code>22</code></strong></p>
</li>
<li>
<p dir="auto">Run the command <strong><code>Plugins &gt; LuaScript &gt; Execute Current File</code></strong></p>
</li>
</ul>
<p dir="auto">=&gt; Only the true words <strong><code>test</code></strong>, in <strong>lower</strong>-case, are <strong>selected</strong> ( in lines <strong><code>4</code></strong>, <strong><code>14</code></strong>, <strong><code>18</code></strong> and <strong><code>22</code></strong> )</p>
<hr />
<p dir="auto">Finally :</p>
<ul>
<li>
<p dir="auto"><strong>Comment</strong> the <strong><code>editor.SearchFlags = 4 | 2 ...........</code></strong></p>
</li>
<li>
<p dir="auto">**<strong>Uncomment</strong> the <strong><code>editor.SearchFlags = SCFIND_REGEXP | SCFIND_MATCHCASE</code></strong></p>
</li>
<li>
<p dir="auto"><strong>Select</strong> all line <strong><code>5</code></strong> contents ( <strong><code>T.*T</code></strong> )</p>
</li>
<li>
<p dir="auto">Run the command <strong><code>Plugins &gt; LuaScript &gt; Execute Current File</code></strong></p>
</li>
</ul>
<p dir="auto">=&gt; As expected, the <strong>longest</strong> ranges of text of lines, <strong>beginning</strong> and <strong>ending</strong> with the <strong>upper</strong>-case letter <strong><code>T</code></strong>, are <strong>selected</strong>, even <strong>embedded</strong> in other ranges of characters !</p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
<p dir="auto"><strong>P.S.</strong> : A last <strong>interesting</strong> test :</p>
<ul>
<li>First, create this tiny <strong>lua</strong> script, below, which you’ll name <strong><code>Test_2.lua</code></strong> :</li>
</ul>
<pre><code>editor.SearchFlags = 0

editor:TargetWholeDocument()

print ("Parameters SET !")
</code></pre>
<ul>
<li>Then, create a <strong>dummy</strong> file, containing, <strong><code>100</code></strong> times, the <strong>sample</strong> text, below :</li>
</ul>
<pre><code class="language-diff">This a test of MULTI-selections
test of MULTI-selections
1234567890This a test of MULTI-selections
t.*t										This a test of MULTI-selections
                                                        This a test of MULTI-selections
This atestof MULTI-selections
This a TeSt of MULTI-selections 1234567890
This a test
This a test of MULTI-selections
test
</code></pre>
<p dir="auto">=&gt; So, you get a <strong><code>1,000</code></strong> lines text, <strong>each</strong> containing the word <strong>Test</strong>, in <strong>various</strong> cases</p>
<ul>
<li>
<p dir="auto"><strong>Save</strong> it in your <strong>current</strong> directory</p>
</li>
<li>
<p dir="auto">Move back to the <strong>beginning</strong> of this <strong>test</strong> file ( <strong><code>Ctrl + Home</code></strong> )</p>
</li>
<li>
<p dir="auto">Execute the menu command <strong><code>Plugins &gt; LuaScript &gt; Show console</code></strong></p>
</li>
<li>
<p dir="auto">In the opened <strong>lua</strong> console, write the command <strong><code>winfile.dofile("Test_2.lua")</code></strong> and <strong>valid</strong> with the <strong><code>Enter</code></strong> key</p>
</li>
</ul>
<p dir="auto">=&gt; The message <strong>Parameters SET !</strong> confirms the <strong>good</strong> execution of the script</p>
<ul>
<li>
<p dir="auto">Then <strong>double</strong>-click on the word <strong><code>test</code></strong>, in line <strong><code>1</code></strong> of <strong>current</strong> file</p>
</li>
<li>
<p dir="auto">Finally, <strong>run</strong> the menu command <strong><code>Plugins &gt; LuaScript &gt; Selection Add Each</code></strong></p>
</li>
</ul>
<p dir="auto">Waaaaouh ! Immediately, <strong><code>1,000</code></strong> words <strong>Test</strong> are selected, at <strong>once</strong> ! And, after hitting the <strong><code>Right arrow</code></strong> key, <strong><code>1,000</code></strong> <strong>cursors</strong> are visible and <strong>available</strong> for adding/deleting characters ;-)))</p>
<p dir="auto"><strong>This</strong> is <strong>multi</strong>-selection !!!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43683</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43683</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 22 May 2019 11:38:38 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Tue, 21 May 2019 16:53:29 GMT]]></title><description><![CDATA[<p dir="auto">Quite a while ago (before Notepad++ updated Scintilla) I found the “find and add next” functionality very useful in other editors and knew that Scintilla supported it in newer versions. I dug through the Scintilla source code and translated it to this LuaScript code:</p>
<pre><code>npp.AddShortcut("Selection Add Next", "Ctrl+D", function()
    -- From SciTEBase.cxx
    local flags = SCFIND_MATCHCASE -- can use 0
    editor:SetTargetRange(0, editor.TextLength)
    editor.SearchFlags = flags

    -- From Editor.cxx
    if editor.SelectionEmpty or not editor.MultipleSelection then
        local startWord = editor:WordStartPosition(editor.CurrentPos, true)
        local endWord = editor:WordEndPosition(startWord, true)
        editor:SetSelection(startWord, endWord)
    else
        local i = editor.MainSelection
        local s = editor:textrange(editor.SelectionNStart[i], editor.SelectionNEnd[i])
        local searchRanges = {{editor.SelectionNEnd[i], editor.TargetEnd}, {editor.TargetStart, editor.SelectionNStart[i]}}
        for _, range in pairs(searchRanges) do
            editor:SetTargetRange(range[1], range[2])
            if editor:SearchInTarget(s) ~= -1 then
                editor:AddSelection(editor.TargetStart, editor.TargetEnd)
                editor:ScrollRange(editor.TargetStart, editor.TargetEnd)
                break
            end
        end
    end
end)
</code></pre>
<p dir="auto">In theory this should be the exact functionality (well, very close at least) that <code>SCI_MULTIPLESELECTADDNEXT</code> provides. Should be translatable to PythonScript or NppExec as this above code was working with Scintilla v3.5.6</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43660</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43660</guid><dc:creator><![CDATA[dail]]></dc:creator><pubDate>Tue, 21 May 2019 16:53:29 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Tue, 21 May 2019 15:28:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/cipher-1024" aria-label="Profile: cipher-1024">@<bdi>cipher-1024</bdi></a> said:</p>
<blockquote>
<p dir="auto">I was hoping to easily go one ‘find’ at a time</p>
</blockquote>
<p dir="auto">I guess we ignored that part of the request. :)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43658</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43658</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 21 May 2019 15:28:11 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Tue, 21 May 2019 13:52:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a> said:</p>
<blockquote>
<p dir="auto">(and working) version of the script:</p>
</blockquote>
<h3>CONFIRMED! :)</h3>
]]></description><link>https://community.notepad-plus-plus.org/post/43653</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43653</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 21 May 2019 13:52:23 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Tue, 21 May 2019 13:49:15 GMT]]></title><description><![CDATA[<p dir="auto">Got it. <code>SCI_WORDRIGHTEXTEND</code> has to be replaced by <code>SCI_WORDRIGHTENDEXTEND</code> - of course. :(</p>
<p dir="auto">Here is the updated (and <strong>working</strong>) version of the script:</p>
<pre><code>sci_sendmsg SCI_GETSELECTIONEMPTY

if $(MSG_RESULT) == 1 then
  sci_sendmsg SCI_GETCURRENTPOS
  set local $(CurPos) ~ $(MSG_RESULT)

  sci_sendmsg SCI_WORDSTARTPOSITION $(CurPos) 1

  if $(MSG_RESULT) != $(CurPos) then
    sci_sendmsg SCI_WORDLEFT
  endif

  sci_sendmsg SCI_WORDRIGHTENDEXTEND
endif

sci_sendmsg SCI_SETSEARCHFLAGS SCFIND_WHOLEWORD 

sci_sendmsg 2690
sci_sendmsg 2689
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/43652</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43652</guid><dc:creator><![CDATA[dinkumoil]]></dc:creator><pubDate>Tue, 21 May 2019 13:49:15 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Tue, 21 May 2019 13:34:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a></p>
<p dir="auto">Not sure if I understand the q…  The PS doesn’t use the “word-right-extend” stuff, which seems to be where the trouble lies with the NppExec scripts presented to this point…</p>
<p dir="auto">I didn’t do exhaustive testing on the PS, but yea, seems to work as intended.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43651</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43651</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 21 May 2019 13:34:30 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Tue, 21 May 2019 13:31:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a></p>
<p dir="auto">Does your Python script work as intended or is it a problem with the algorithm used?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43650</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43650</guid><dc:creator><![CDATA[dinkumoil]]></dc:creator><pubDate>Tue, 21 May 2019 13:31:25 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Tue, 21 May 2019 13:25:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a></p>
<p dir="auto">Yea, if you’ll take note, I had an intentional big amount of spaces to the right of the word I had my caret in for my testing. :)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43649</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43649</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 21 May 2019 13:25:29 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Tue, 21 May 2019 13:23:09 GMT]]></title><description><![CDATA[<p dir="auto">Hmm, I found a strange pitfall with my code.</p>
<p dir="auto">I use for testing the same snippet of source code <a class="plugin-mentions-user plugin-mentions-a" href="/user/dail" aria-label="Profile: dail">@<bdi>dail</bdi></a> used in his posting in the other thread:</p>
<pre><code>static std::string getWordAt(GUI::ScintillaWindow *window, int pos) {
  int word_start = window-&gt;Call(SCI_WORDSTARTPOSITION, pos, true);
  int word_end = window-&gt;Call(SCI_WORDENDPOSITION, pos, true);
  return getRange(window, word_start, word_end);
}
</code></pre>
<p dir="auto">If I place the cursor before the word <code>pos</code> near the end of line 1 and press my keyboard shortcut everything works fine. If I do the same with placeing it before the word <code>int</code> near the end of line 1, the script selects the word <code>int</code> <strong>and</strong> the following space character and nothing more happens. It looks like the <code>sci_sendmsg SCI_WORDRIGHTEXTEND</code> gives a wrong result.</p>
<p dir="auto">I will try to figure out what’s going on…</p>
<p dir="auto">EDIT: It’s because <code>int</code> is followed by a space character and <code>pos</code> by opening parenthesis. This would make this feature nearly useless. Gonna do further investigations…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43647</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43647</guid><dc:creator><![CDATA[dinkumoil]]></dc:creator><pubDate>Tue, 21 May 2019 13:23:09 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Tue, 21 May 2019 13:12:07 GMT]]></title><description><![CDATA[<p dir="auto">Totally just for fun, I managed to replicate the functionality with Pythonscript in its current (1.4) form:</p>
<pre><code>import ctypes
from ctypes.wintypes import HWND
from ctypes import byref, wintypes, Structure, sizeof

def get_focused_window():
    class GUITHREADINFO(Structure):
        _fields_ = [
            ("cbSize", wintypes.DWORD),
            ("flags", wintypes.DWORD),
            ("hwndActive", wintypes.HWND),
            ("hwndFocus", wintypes.HWND),  # &lt;--- what we really want
            ("hwndCapture", wintypes.HWND),
            ("hwndMenuOwner", wintypes.HWND),
            ("hwndMoveSize", wintypes.HWND),
            ("hwndCaret", wintypes.HWND),
            ("rcCaret", wintypes.RECT)
            ]
    guiThreadInfo = GUITHREADINFO(cbSize=sizeof(GUITHREADINFO))
    ctypes.windll.user32.GetGUIThreadInfo(0, byref(guiThreadInfo))
    return guiThreadInfo.hwndFocus

current_view_hwnd = get_focused_window()

SciLexer = ctypes.WinDLL('SciLexer.dll', use_last_error = True)
Scintilla_DirectFunction = SciLexer.Scintilla_DirectFunction
direct_pointer = SendMessage(current_view_hwnd, 2185, 0, 0)

editor.setSearchFlags(FINDOPTION.WHOLEWORD | FINDOPTION.MATCHCASE)

if editor.getSelectionEmpty():
    start_of_word_pos = editor.wordStartPosition(editor.getCurrentPos(), True)
    end_of_word_pos = editor.wordEndPosition(start_of_word_pos, True)
    if start_of_word_pos != end_of_word_pos:
        editor.setSelection(end_of_word_pos, start_of_word_pos)

Scintilla_DirectFunction(direct_pointer, 2689, 1, 0)
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/43646</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43646</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 21 May 2019 13:12:07 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Tue, 21 May 2019 13:10:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a></p>
<blockquote>
<p dir="auto">Did you restart Notepad++ after updating the script?</p>
</blockquote>
<p dir="auto">No, but I didn’t “save” it, I was just running it as a NppExec temporary script…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43645</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43645</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 21 May 2019 13:10:17 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Tue, 21 May 2019 13:03:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said:</p>
<blockquote>
<p dir="auto">I tried the NppExec script just above and had the same result as the earlier NppExec script when no selection before running…</p>
</blockquote>
<p dir="auto">It works at my site. Did you restart Notepad++ after updating the script?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43644</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43644</guid><dc:creator><![CDATA[dinkumoil]]></dc:creator><pubDate>Tue, 21 May 2019 13:03:04 GMT</pubDate></item><item><title><![CDATA[Reply to Find and Add To Selection In 7.7 on Tue, 21 May 2019 13:00:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a> said:</p>
<blockquote>
<p dir="auto">Oh, I’ve posted before I could even see your posting…</p>
</blockquote>
<p dir="auto">I tried the NppExec script just above and had the same result as the earlier NppExec script when no selection before running…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/43643</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/43643</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 21 May 2019 13:00:53 GMT</pubDate></item></channel></rss>