<?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[How to replace selected text of a selected rectangle?]]></title><description><![CDATA[<p dir="auto">Hey,<br />
I wrote a plugin that should format some selected text.<br />
If the selection is a complete line I can use SCI_REPLACESEL to insert the modified text.</p>
<p dir="auto">What do I have to do, if I want to replace the text of a selected rectangle?</p>
<p dir="auto">Thanks in advance<br />
Ollo</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/16664/how-to-replace-selected-text-of-a-selected-rectangle</link><generator>RSS for Node</generator><lastBuildDate>Sun, 11 Oct 2026 17:50:37 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/16664.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 20 Nov 2018 13:24:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to replace selected text of a selected rectangle? on Wed, 21 Nov 2018 15:23:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ollo-he%C3%9F" aria-label="Profile: Ollo-Heß">@<bdi>Ollo-Heß</bdi></a></p>
<p dir="auto">I understand the <em>desire</em> for it to be simple for the rectangular column selection case, but it is important that you <em>understand</em> why it is not so, and thus why there is no simple 2-step <em>get-selection</em> and <em>replace-selection</em> for this.</p>
<p dir="auto">Let me first ask you some questions about what you are doing:</p>
<ul>
<li>Does the initially selected rectangular block ever have any virtual space in it?</li>
<li>Are all of the lines/rows in the rectangular block you are replacing with of the same length (same number of columns for each line; note that it is fine if this is different from the number of columns in the initial selection)?</li>
<li>Does the rectangular block you are replacing with always have the same number of lines/rows as the initially selected rectangular block?</li>
</ul>
<p dir="auto">[Maybe these questions will get you thinking along the lines of <em>why</em> this can be a difficult thing to do…]</p>
<p dir="auto">If the answers are “no”/“yes”/“yes” then the situation is “fairly” simple, and I can describes some possible ways to implement (but let’s have those answers first).  We can of course discuss the cases where the answers aren’t “no”/“yes”/“yes”, but the complexity increases.  :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/36655</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/36655</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Wed, 21 Nov 2018 15:23:01 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace selected text of a selected rectangle? on Wed, 21 Nov 2018 13:02:14 GMT]]></title><description><![CDATA[<p dir="auto">Hey <a class="plugin-mentions-user plugin-mentions-a" href="/user/scott-sumner" aria-label="Profile: scott-sumner">@<bdi>scott-sumner</bdi></a>,<br />
thanks for your answer, but unfortunately it doesn’t help me.</p>
<p dir="auto">Before I posted my question here, I took a look at the Scintilla Documentation.</p>
<p dir="auto">I wrote a plugin library that reads the selected text -&gt; SCI_GETSELTEXT<br />
This works fine, with all selection kinds.</p>
<p dir="auto">If I select a rectagle, e. g. a column, I get a multiline text with linebreaks.</p>
<p dir="auto">Now, my formatting function modifies this text.</p>
<p dir="auto">After this modification I need to replace the selected text of the document.<br />
I tried SCI_REPLACESEL, but this inserts the text with the linebreaks at the fist position of the selection.<br />
So, not the selected rectangle will be replaced.</p>
<p dir="auto">How can I replace the text of a selected rectangle?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/36638</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/36638</guid><dc:creator><![CDATA[Ollo Heß]]></dc:creator><pubDate>Wed, 21 Nov 2018 13:02:14 GMT</pubDate></item><item><title><![CDATA[Reply to How to replace selected text of a selected rectangle? on Tue, 20 Nov 2018 18:49:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ollo-he%C3%9F" aria-label="Profile: Ollo-Heß">@<bdi>Ollo-Heß</bdi></a></p>
<p dir="auto">You have to take a more manual approach to it using other (“lower-level”) <a href="https://www.scintilla.org/ScintillaDoc.html" rel="nofollow ugc">SCI_ functions</a> for getting selections and replacing text.  If that isn’t enough of a help for you, post again requesting more details.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/36609</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/36609</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Tue, 20 Nov 2018 18:49:52 GMT</pubDate></item></channel></rss>