<?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[Duplicate behavior - duplicate whole lines]]></title><description><![CDATA[<p dir="auto">When I duplicate when having the selection. e.g. from “a” to 2nd “c” in this case:</p>
<pre><code>abcdef
abcdef
</code></pre>
<p dir="auto">I get this:</p>
<pre><code>abcdef
abcabcdef
abcdef
</code></pre>
<p dir="auto">Is it possible to get this? - Duplicate whole lines with selection</p>
<pre><code>abcdef
abcdef
abcdef
abcdef
</code></pre>
<p dir="auto">I’m not sure, but I think it worked like that in the past or maybe I just remember it from a different program.</p>
<pre><code>Notepad++ v8.7   (64-bit)
Build time : Sep 17 2024 - 17:06:31
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line : "C:\Program Files\Notepad++\change.log" 
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : C:\DATA\cfg\notepad++
Periodic Backup : ON
OS Name : Windows 10 Education (64-bit)
OS Version : 22H2
OS Build : 19045.5011
Current ANSI codepage : 1252
Plugins : 
    DSpellCheck (1.5)
    HexEditor (0.9.12)
    mimeTools (3.1)
    NppConverter (4.6)
    NppExport (0.4)
    urlPlugin (1.2)

</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/topic/26219/duplicate-behavior-duplicate-whole-lines</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Apr 2026 17:55:17 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/26219.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 22 Oct 2024 12:09:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Duplicate behavior - duplicate whole lines on Sun, 27 Oct 2024 10:38:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3148">@Nicholas</a></p>
<p dir="auto">Yes, but that’s probably not relevant to the OP’s situation.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97362</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97362</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sun, 27 Oct 2024 10:38:30 GMT</pubDate></item><item><title><![CDATA[Reply to Duplicate behavior - duplicate whole lines on Sun, 27 Oct 2024 00:12:04 GMT]]></title><description><![CDATA[<p dir="auto">If you click and drag on the line numbers it will select the whole line. I always use this method when selecting lines I want to duplicate or copy.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97352</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97352</guid><dc:creator><![CDATA[Nicholas]]></dc:creator><pubDate>Sun, 27 Oct 2024 00:12:04 GMT</pubDate></item><item><title><![CDATA[Reply to Duplicate behavior - duplicate whole lines on Sat, 26 Oct 2024 14:06:18 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> Thanks, I’ll probably do that when I have some free time. For now, I’ll stick to the combination of my macro/SCI_SELECTIONDUPLICATE as it is good enough.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97347</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97347</guid><dc:creator><![CDATA[RARgames]]></dc:creator><pubDate>Sat, 26 Oct 2024 14:06:18 GMT</pubDate></item><item><title><![CDATA[Reply to Duplicate behavior - duplicate whole lines on Thu, 24 Oct 2024 21:31:51 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> ,</p>
<p dir="auto">I believe <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/25866">@RARgames</a> is relying on a side effect: if your caret is on a line that’s shorter than the screen-width (or than the first vertical edge setting), then <code>Ctrl+I</code>’s “Split Lines” actions will select the whole line, split it into one line, and finish with the whole line is suggested.</p>
<p dir="auto">If <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/25866">@RARgames</a> had instead tried on a line that goes beyond the first vertical edge setting or screen width, the <code>Ctrl+I</code> would have actually split the lines into 2 or more lines, and ended with all N of those lines selected.  To continue with that modified macro invites the danger of accidentally splitting long lines in the future.</p>
<p dir="auto">Further, doing the <code>Ctrl+I</code> first would only do anything for <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/25866">@RARgames</a> if there was a stream selection that went from the middle of one line to the middle of some other line (or from the beginning of one line to the end of another without selecting the EOL sequence).</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/25866">@RARgames</a> said,</p>
<blockquote>
<p dir="auto">it would be better to return to a previous cursor placement</p>
</blockquote>
<p dir="auto">Macros don’t have variables/memory, so they have no place to track such a thing.  As our <a href="/topic/25400">Notepad++ Automation FAQ</a> says, if you need something with “memory”, you need to switch from Macros to a true programming language, like one of the scripting plugins (PythonScript Plugin being the most-frequently mentioned, here).  With a scripting plugin, you could put the full logic: "look at the active stream selection; if the start of the selection is not at the start of the line, move it to the start of the line; if the end of the selection is not after the EOL sequence (or not at EOF if the end of the last line doesn’t have EOL)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97302</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97302</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 24 Oct 2024 21:31:51 GMT</pubDate></item><item><title><![CDATA[Reply to Duplicate behavior - duplicate whole lines on Thu, 24 Oct 2024 15:25:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/25866">@RARgames</a> said in <a href="/post/97291">Duplicate behavior - duplicate whole lines</a>:</p>
<blockquote>
<p dir="auto">press Ctrl+I to select whole lines, but without last new line char</p>
</blockquote>
<p dir="auto">By default Ctrl+i is assigned to the <em>Split Lines</em> command, and I don’t see how that is helpful here??</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97297</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97297</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Thu, 24 Oct 2024 15:25:31 GMT</pubDate></item><item><title><![CDATA[Reply to Duplicate behavior - duplicate whole lines on Thu, 24 Oct 2024 12:38: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> I noticed the 2nd one too - it is quite bad.<br />
Also, there was a second issue when I started using it, but I don’t remember it right now.</p>
<p dir="auto">So I replaced it with slightly different macro:</p>
<ul>
<li>press <code>Ctrl+I</code> to select whole lines, but without last new line char</li>
<li>press <code>Shift+Right Arrow</code> to add this new line char (there is an issue if there is no new line[end of the file] - same with previous macro)</li>
<li>press <code>Ctrl+D</code> to duplicate</li>
<li>press `Home to return to the line start (I don’t like this - it would be better to return to a previous cursor placement)</li>
</ul>
<p dir="auto">It works better for me, but still has some issues.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97291</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97291</guid><dc:creator><![CDATA[RARgames]]></dc:creator><pubDate>Thu, 24 Oct 2024 12:38:28 GMT</pubDate></item><item><title><![CDATA[Reply to Duplicate behavior - duplicate whole lines on Wed, 23 Oct 2024 15:58:35 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> ,</p>
<p dir="auto">Yes, I think <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a>’s post should be more explicit about “assuming <code>Ctrl+D</code> is mapped to <code>SCI_SELECTIONDUPLICATE</code> (which is the default mapping)”, because this discussion was begun with someone wanting to redefine the <code>Ctrl+D</code> behavior.</p>
<p dir="auto">Also, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/195">@guy038</a> said,</p>
<blockquote>
<p dir="auto">However if you do a seven-lines RECTANGULAR selection , at the beginning and, then, hit the <code>End</code> key, now, clicking several times on the <code>Ctrl + D</code> shortcut just add one copy of each line, at a time !</p>
</blockquote>
<p dir="auto">… that is only true if <strong>Preferences &gt; Editing 2 &gt; ☑ Enable Column Selection to Multi-Editing</strong> is checkmarked.  If it is not checkmarked, then when you hit <code>END</code>, it leaves column-mode or multi-edit selection mode, and the caret just moves to the end of what used to be the rectangle.  (It took me a while to figure this out, because I could replicate all the other behavior mentioned, but I was just not getting the one-copy-of-the-line behavior described.)</p>
<p dir="auto">For any such discussion, Preference and Shortcut Mapper states can be quite important to the discussion.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97269</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97269</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 23 Oct 2024 15:58:35 GMT</pubDate></item><item><title><![CDATA[Reply to Duplicate behavior - duplicate whole lines on Wed, 23 Oct 2024 15:16:49 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/97254">Duplicate behavior - duplicate whole lines</a>:</p>
<blockquote>
<p dir="auto">did you know these particularities when you invoke the Ctrl + D shortcut</p>
</blockquote>
<p dir="auto">I think it might be <em>poor</em> to talk in terms of Ctrl+d, because if memory serves, this shortcut has had some inconsistency (in what command it is tied to) in Notepad++'s history.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97262</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97262</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 23 Oct 2024 15:16:49 GMT</pubDate></item><item><title><![CDATA[Reply to Duplicate behavior - duplicate whole lines on Wed, 23 Oct 2024 12:37:59 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/25866">@rargames</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/3841">@peterjones</a> and <strong>All</strong>,</p>
<p dir="auto">BTW, did you know these <strong>particularities</strong> when you invoke the <strong><code>Ctrl + D</code></strong> shortcut …</p>
<hr />
<p dir="auto">Let’s start with this <em>INPUT</em> text :</p>
<pre><code class="language-diff">This is an
simple example
of text to
see the different
resulting texts
when invoking the
Ctrl-D shortcut
</code></pre>
<p dir="auto">Now, do a <strong>normal</strong> selection of <strong>all</strong> this text and use the <strong><code>Ctrl + D</code></strong> shortcut. We get the <strong>usual</strong> new text , below :</p>
<pre><code class="language-diff">This is an
simple example
of text to
see the different
resulting texts
when invoking the
Ctrl-D shortcut
This is an
simple example
of text to
see the different
resulting texts
when invoking the
Ctrl-D shortcut
</code></pre>
<hr />
<p dir="auto">If, instead of a <strong>stream</strong> selection, we use a <strong>zero</strong>-length <em>RECTANGULAR</em> selection, <strong>whatever</strong> its location, among all <strong>allowed</strong> ones. Then, after a <strong><code>Ctrl + D</code></strong> operation, we get this text :</p>
<pre><code class="language-diff">This is an
This is an
simple example
simple example
of text to
of text to
see the different
see the different
resulting texts
resulting texts
when invoking the
when invoking the
Ctrl-D shortcut
Ctrl-D shortcut
</code></pre>
<p dir="auto">And, if you hit the <strong><code>Ctrl + D</code></strong> shortcut again, every block of <strong>two</strong> lines is, itself, <strong>duplicated</strong>. Just as expected !</p>
<p dir="auto">However if you do a <strong>seven</strong>-lines <em>RECTANGULAR</em> selection , at the <strong>beginning</strong> and, then, hit the <strong><code>End</code></strong> key, now, clicking <strong>several</strong> times on the <strong><code>Ctrl + D</code></strong> shortcut just add <strong>one</strong> copy of <strong>each</strong> line, at a time !</p>
<hr />
<p dir="auto">Of course, if we select a <strong>non-zero</strong> <em>RECTANGULAR</em> selection of these <strong>seven</strong> <em>INPUT</em> lines, we get, as expected, <strong>all</strong> text selected being written <strong>twice</strong> !</p>
<p dir="auto">For instance, let’s do a <strong>four</strong> chars <em>RECTANGULAR</em> selection, beginning right <strong>before</strong> the word <strong><code>an</code></strong> of the <strong>first</strong> line and ending at string <strong><code>hort</code></strong> of the <strong>seventh</strong> line</p>
<p dir="auto">After using the <strong><code>Ctrl + D</code></strong> shortcut, the <em>OUTPUT</em> text becomes :</p>
<pre><code class="language-diff">This is anan
simple exampxample
of text toto
see the diffdifferent
resulting teg texts
when invokinoking the
Ctrl-D shorthortcut
</code></pre>
<hr />
<p dir="auto">For the record :</p>
<ul>
<li>
<p dir="auto">If you do a <strong>normal</strong> selection of <strong>one</strong> line only, <strong>without</strong> its like-break, the text of all this line is simply added right <strong>after</strong>, on the <strong>same</strong> line</p>
</li>
<li>
<p dir="auto">If you do a <strong>normal</strong> selection of <strong>one</strong> line only, <strong>with</strong> its line-break, all the text and its like break is duplicated on the line <strong>below</strong></p>
</li>
</ul>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97254</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97254</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 23 Oct 2024 12:37:59 GMT</pubDate></item><item><title><![CDATA[Reply to Duplicate behavior - duplicate whole lines on Wed, 23 Oct 2024 11:24:04 GMT]]></title><description><![CDATA[<p dir="auto">The macro is a good suggestion, but there are some caveats:</p>
<ul>
<li>the original selection needs to be a stream selection; if it is a column block selection it will not work</li>
<li>the original selection needs to contain a line ending (or more than one); if the selection is only on a single line it will not work</li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/97251</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97251</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 23 Oct 2024 11:24:04 GMT</pubDate></item><item><title><![CDATA[Reply to Duplicate behavior - duplicate whole lines on Tue, 22 Oct 2024 17:23:02 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> Thanks, that’s exactly what I wanted.</p>
<p dir="auto">EDIT: Also thanks for the macro suggestion!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97236</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97236</guid><dc:creator><![CDATA[RARgames]]></dc:creator><pubDate>Tue, 22 Oct 2024 17:23:02 GMT</pubDate></item><item><title><![CDATA[Reply to Duplicate behavior - duplicate whole lines on Tue, 22 Oct 2024 13:34:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/25866">@RARgames</a> ,</p>
<p dir="auto">Sorry, I didn’t notice in your original statement that the selection went across multiple lines.</p>
<p dir="auto">No single Scintilla command will do exactly what you want.  But you could record Alan’s sequence as a macro, and assign that macro to a keyboard shortcut.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97233</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97233</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Tue, 22 Oct 2024 13:34:21 GMT</pubDate></item><item><title><![CDATA[Reply to Duplicate behavior - duplicate whole lines on Tue, 22 Oct 2024 13:22:20 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> I tried it already, but this always duplicates only 1 line, instead of all lines in selection</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97232</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97232</guid><dc:creator><![CDATA[RARgames]]></dc:creator><pubDate>Tue, 22 Oct 2024 13:22:20 GMT</pubDate></item><item><title><![CDATA[Reply to Duplicate behavior - duplicate whole lines on Tue, 22 Oct 2024 13:26:53 GMT]]></title><description><![CDATA[<p dir="auto"><code>SCI_LINEDUPLICATE</code> doesn’t act upon all lines of selected text, only upon the (single) line of the caret.<br />
Thus the OP’s desire as originally expressed is not satisfied.</p>
<p dir="auto">There is no built-in way to achieve: “Duplicate all lines touched by the selection”, AFAIK.<br />
Well…unless you select the lines in-full and then do <code>SCI_SELECTIONDUPLICATE</code>.<br />
But if you just want to <em>partially</em> select some lines and have it work on the full lines…then no.</p>
<p dir="auto">A workaround, where you  start with partially selected line(s):</p>
<ul>
<li>press Tab to indent the lines (lines become fully-selected)</li>
<li>press Shift+Tab to dedent the lines (lines are still fully-selected)</li>
<li>now do <code>SCI_SELECTIONDUPLICATE</code></li>
</ul>
]]></description><link>https://community.notepad-plus-plus.org/post/97231</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97231</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 22 Oct 2024 13:26:53 GMT</pubDate></item><item><title><![CDATA[Reply to Duplicate behavior - duplicate whole lines on Tue, 22 Oct 2024 13:20:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/25866">@RARgames</a> said in <a href="/post/97229">Duplicate behavior - duplicate whole lines</a>:</p>
<blockquote>
<p dir="auto">I want to find something that allows me to press Ctrl+D to duplicate whole lines.</p>
</blockquote>
<p dir="auto">Then give your preferred keyboard shortcut to SCI_LINEDUPLICATE instead – it defaults to nothing, as shown below, but you can assign whatever shortcut you want to it (and remove the shortcut from SCI_SELECTIONDUPLICATE if you don’t ever want to use the fancier “duplicate selection, unless there is no selection in which case duplicate the whole line”)</p>
<p dir="auto"><img src="/assets/uploads/files/1729603012719-6575c033-328d-4cf8-944d-698c69e53978-image.png" alt="6575c033-328d-4cf8-944d-698c69e53978-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/97230</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97230</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Tue, 22 Oct 2024 13:20:30 GMT</pubDate></item><item><title><![CDATA[Reply to Duplicate behavior - duplicate whole lines on Tue, 22 Oct 2024 12:44:22 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> Sorry, <code>Ctrl+D</code>, which executes (by default? -not sure if I changed it in the past) SCI_SELECTIONDUPLICATE</p>
<p dir="auto">and I want to find something that allows me to press <code>Ctrl+D</code> to duplicate whole lines.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97229</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97229</guid><dc:creator><![CDATA[RARgames]]></dc:creator><pubDate>Tue, 22 Oct 2024 12:44:22 GMT</pubDate></item><item><title><![CDATA[Reply to Duplicate behavior - duplicate whole lines on Tue, 22 Oct 2024 12:35:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/25866">@RARgames</a> said in <a href="/post/97227">Duplicate behavior - duplicate whole lines</a>:</p>
<blockquote>
<p dir="auto">When I duplicate</p>
</blockquote>
<p dir="auto">That statement is vague.<br />
What are you doing to “duplicate”?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/97228</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/97228</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 22 Oct 2024 12:35:01 GMT</pubDate></item></channel></rss>