<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent posts to Modify Lines</title><link>https://sourceforge.net/p/npppythonscript/discussion/1199074/thread/77280195/</link><description>Recent posts to Modify Lines</description><atom:link href="https://sourceforge.net/p/npppythonscript/discussion/1199074/thread/77280195/feed.rss" rel="self"/><language>en</language><lastBuildDate>Wed, 24 Jun 2015 11:17:39 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/npppythonscript/discussion/1199074/thread/77280195/feed.rss" rel="self" type="application/rss+xml"/><item><title>Modify Lines</title><link>https://sourceforge.net/p/npppythonscript/discussion/1199074/thread/77280195/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Nice!  I don't know if I'll use it directly, but I learned some techniques from it (.setProperty/.getProperty, use of ctrl+enter) that I will apply to my own scripts.  Thanks.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sasumner</dc:creator><pubDate>Wed, 24 Jun 2015 11:17:39 -0000</pubDate><guid>https://sourceforge.net4ec57ce1ae5b2b7b70d04298ef653e568da28e9d</guid></item><item><title>Modify Lines</title><link>https://sourceforge.net/p/npppythonscript/discussion/1199074/thread/77280195/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;This script emulates the basic functionality of the Modify Lines command in &lt;a class="" href="http://www.flos-freeware.ch/notepad2.html" rel="nofollow"&gt;Notepad2&lt;/a&gt;. It allows you to select a bunch of lines and add some text before and at the end of each of the selected lines. If no text is selected, then it will act on every line in the document.&lt;/p&gt;
&lt;p&gt;Code:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;sInput = notepad.prompt('Enter the text to prefix before each selected line, followed by a line break (Ctrl+Enter), then the text to append to the end of each selected line.', 'Modify Lines', editor.getProperty('modify_lines'))
if sInput:
    # Save to reuse the next time this script is called
    editor.setProperty('modify_lines', sInput)
    # aInput[0] = line prefix
    # aInput[1] = line postfix (optional)
    aInput = sInput.splitlines()
    # aSelLines[0] = start line number of selection
    # aSelLines[1] = end line number of selection
    aSelLines = editor.getUserLineSelection()
    # Do the replacement (multi-line mode is enabled by default)
    editor.rereplace('^', aInput[0], 0, editor.positionFromLine(aSelLines[0]), editor.getLineEndPosition(aSelLines[1]))
    if len(aInput) &amp;gt; 1:
        editor.rereplace('$', aInput[1], 0, editor.positionFromLine(aSelLines[0]), editor.getLineEndPosition(aSelLines[1]))
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">l0basetom</dc:creator><pubDate>Wed, 24 Jun 2015 07:30:38 -0000</pubDate><guid>https://sourceforge.netcbe28b601e2726713b0e4ce1fd99fa312193b025</guid></item></channel></rss>