<?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[Margin Manipulation]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/claudia-frank" aria-label="Profile: Claudia-Frank">@<bdi>Claudia-Frank</bdi></a> ,</p>
<p dir="auto">A short pythonscript example for margin-manipulation would be nice to see if you have one…hint, hint…  Reading the documentation on this and deriving something that works doesn’t seem to be easy (tried a bit of time ago…)</p>
<p dir="auto">I’m not interested in zero-basing line numbers (intrigued by what drives that desire, though!), but rather how to use the margin for other purposes.</p>
<p dir="auto">If pressed to be more specific, perhaps the type of margin manipulation that the LocationNavigate plugin provides for changed line marking would be a good example.  Note that I’m NOT asking for a rewrite of that complete functionality in pythonscript, just something that illustrates that type of margin-marking.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/12437/margin-manipulation</link><generator>RSS for Node</generator><lastBuildDate>Sat, 06 Jun 2026 13:50:16 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/12437.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 29 Sep 2016 14:06:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Margin Manipulation on Thu, 29 Sep 2016 22:49:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/scott-sumner" aria-label="Profile: Scott-Sumner">@<bdi>Scott-Sumner</bdi></a></p>
<p dir="auto">Hi Scott,</p>
<p dir="auto">are you more interested in how to create your own marker symbol or how to show a marker<br />
in the margin when changes occur?</p>
<p dir="auto">A quick script for the later would look like</p>
<pre><code>editor.setMarginTypeN(3,4)   
editor.setMarginWidthN(3,20)

def callback_MODIFIED(args):
    if args['modificationType'] &amp; 0x1:
        editor.marginSetText(editor.lineFromPosition(args['position']), '&gt;')
    elif args['modificationType'] &amp; 0x2: 
        editor.marginSetText(editor.lineFromPosition(args['position']), '&lt;')


editor.clearCallbacks([SCINTILLANOTIFICATION.MODIFIED])
editor.callback(callback_MODIFIED, [SCINTILLANOTIFICATION.MODIFIED])
</code></pre>
<p dir="auto">The script uses a text marker instead of a real symbol.<br />
‘&gt;’ should indicate that something was added, and … you know ;-)</p>
<p dir="auto">If it is about changing symbols, hmm …, I didn’t play with it yet. It would involve using</p>
<pre><code>SCI_MARKERDEFINEPIXMAP(int markerNumber, const char *xpm)
SCI_MARKERDEFINERGBAIMAGE(int markerNumber, const char *pixels)
</code></pre>
<p dir="auto">and others to create the images first and then assign like <a class="plugin-mentions-user plugin-mentions-a" href="/user/dail" aria-label="Profile: dail">@<bdi>dail</bdi></a> already showed.<br />
If there is something I can do, let me know - this would be much more interesting than<br />
writing boring documentation.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/18170</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/18170</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Thu, 29 Sep 2016 22:49:36 GMT</pubDate></item><item><title><![CDATA[Reply to Margin Manipulation on Thu, 29 Sep 2016 18:38:41 GMT]]></title><description><![CDATA[<p dir="auto">Notepad++ uses margins 0, 1, and 2 for line numbers, bookmarks, and folding symbols, respectively. There are 5 margins in total so you can use 3 and 4.</p>
<pre><code>my_margin = 3
editor.MarginWidthN[my_margin] = 14 -- Show the margin, using 0 hides it
editor.MarginMaskN[my_margin] = editor.MarginMaskN[my_margin] | (1 &lt;&lt; id)
</code></pre>
<p dir="auto">Now when you add a marker it will show up in the new margin.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/18167</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/18167</guid><dc:creator><![CDATA[dail]]></dc:creator><pubDate>Thu, 29 Sep 2016 18:38:41 GMT</pubDate></item><item><title><![CDATA[Reply to Margin Manipulation on Thu, 29 Sep 2016 18:22:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dail" aria-label="Profile: dail">@<bdi>dail</bdi></a></p>
<p dir="auto">So I ported it to Pythonscript (very easy to do):</p>
<pre><code>arbitrary_marker_id = 10
npp_marker_margin_nbr = 1
editor.markerDefine(arbitrary_marker_id, MARKERSYMBOL.CIRCLE)
editor.setMarginMaskN(npp_marker_margin_nbr, editor.getMarginMaskN(npp_marker_margin_nbr) | (1 &lt;&lt; arbitrary_marker_id))
test_line_nbr_to_mark = 30
editor.markerAdd(test_line_nbr_to_mark - 1, arbitrary_marker_id)
</code></pre>
<p dir="auto">Running it I can see how it uses the same margin that N++ uses for Bookmarks.  I was hoping for something that would show how to create a brand-new margin and then use that (so that Bookmarks wouldn’t cover over it, i.e., could co-exist).</p>
<p dir="auto">I also notice that it must be conflicting with something that LocationNavigate uses, because now the color of my new marker follows Loc Navi’s line change indicators, and other interesting effects…</p>
<p dir="auto">Anyway, it’s a starting point for further experimentation.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/18166</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/18166</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Thu, 29 Sep 2016 18:22:52 GMT</pubDate></item><item><title><![CDATA[Reply to Margin Manipulation on Thu, 29 Sep 2016 15:39:13 GMT]]></title><description><![CDATA[<p dir="auto">Ok not <em>total</em> derailment but worth its own discussion for now ;)</p>
<blockquote>
<p dir="auto">Sorry for the derailing</p>
</blockquote>
<p dir="auto">Mostly my fault since I like playing around with scripting capabilities in Notepad++ :)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/18165</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/18165</guid><dc:creator><![CDATA[dail]]></dc:creator><pubDate>Thu, 29 Sep 2016 15:39:13 GMT</pubDate></item><item><title><![CDATA[Reply to Margin Manipulation on Thu, 29 Sep 2016 15:30:59 GMT]]></title><description><![CDATA[<p dir="auto">Sorry for the derailing…not sure it was a <em>TOTAL</em> derailing as some examples on how to do the alternate line # margin might have helped the OP (of the <a href="https://notepad-plus-plus.org/community/topic/12431/line-numbering-starting-at-zero" rel="nofollow ugc">original topic</a>).</p>
<p dir="auto">dail, thanks for the Lua, I’ll be taking a look at it.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/18164</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/18164</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Thu, 29 Sep 2016 15:30:59 GMT</pubDate></item><item><title><![CDATA[Reply to Margin Manipulation on Thu, 29 Sep 2016 14:55:36 GMT]]></title><description><![CDATA[<p dir="auto">Since this topic got totally away from the original question I split it into a new topic ;) Sorry <a class="plugin-mentions-user plugin-mentions-a" href="/user/eric-colossal" aria-label="Profile: Eric-Colossal">@<bdi>Eric-Colossal</bdi></a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/18162</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/18162</guid><dc:creator><![CDATA[dail]]></dc:creator><pubDate>Thu, 29 Sep 2016 14:55:36 GMT</pubDate></item><item><title><![CDATA[Reply to Margin Manipulation on Thu, 29 Sep 2016 14:45:07 GMT]]></title><description><![CDATA[<p dir="auto">Since I don’t know the PythonScript API (or a current way of testing it) too well I can describe the general idea</p>
<ol>
<li>Create a marker</li>
<li>Set the margin’s options to allow this marker</li>
<li>Add/Remove it to lines as desired</li>
</ol>
<p dir="auto">I can show a LuaScript example. You should be able to easily translate it into PythonScript:</p>
<pre><code>-- Pick a marker ID (not sure what is best)
id = 10

editor:MarkerDefine(id, SC_MARK_CIRCLE)
-- can set fore/back color if desired here
editor.MarginMaskN[1] = editor.MarginMaskN[1] | (1 &lt;&lt; id)
editor:MarkerAdd(30, id) -- add it to line 30
</code></pre>
<p dir="auto">Notepad++ uses some <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/3bf382f16b0b59fd91769b81d3dabaafd05c4a23/PowerEditor/src/ScitillaComponent/ScintillaEditView.h#L122-L125" rel="nofollow ugc">markers internally</a> that you shouldn’t use. So probably any marker ID under 21 would be fine assuming it doesn’t clash with another plugin.</p>
<p dir="auto">Notepad++ uses margin 1 to show markers. The margin mask needs a bit set to allow it to use that id.</p>
<p dir="auto">I’m sure Claudia can show better examples using Python ;)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/18161</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/18161</guid><dc:creator><![CDATA[dail]]></dc:creator><pubDate>Thu, 29 Sep 2016 14:45:07 GMT</pubDate></item><item><title><![CDATA[Reply to Margin Manipulation on Thu, 29 Sep 2016 14:27:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dail" aria-label="Profile: dail">@<bdi>dail</bdi></a></p>
<p dir="auto">Your image shows the functionality.  The marker on line 3 is an unsaved changed line and the marker on line 2 is a saved changed line.  Ideally I’m interested in finding a short pythonscript example on how to do that sort of margin/marker manipulation.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/18160</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/18160</guid><dc:creator><![CDATA[Scott Sumner]]></dc:creator><pubDate>Thu, 29 Sep 2016 14:27:08 GMT</pubDate></item><item><title><![CDATA[Reply to Margin Manipulation on Thu, 29 Sep 2016 14:14:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/scott-sumner" aria-label="Profile: Scott-Sumner">@<bdi>Scott-Sumner</bdi></a></p>
<p dir="auto">I’m not familiar with that plugin. Do you have a screen shot or link to the exact functionality you are referring to?</p>
<p dir="auto">The only image I could quickly find regarding the location navigation plugin and margins is this:</p>
<p dir="auto"><img src="https://camo.nodebb.org/115b4bc72bb12e8fd276af26d7b63292c9411e27?url=https%3A%2F%2Fa.fsdn.com%2Fcon%2Fapp%2Fproj%2Flocationnav%2Fscreenshots%2Fcapture3.jpg" alt="img" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/18159</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/18159</guid><dc:creator><![CDATA[dail]]></dc:creator><pubDate>Thu, 29 Sep 2016 14:14:23 GMT</pubDate></item></channel></rss>