How to add to the selection ?

Joerg Fischer jf505 at gmx.de
Fri Oct 5 11:37:30 CEST 2007


Greg Edwards wrote:

> Team,
> 
> I was sure that Nedit could "add to the current selection", so that I
> could eg. go down a text file and copy sequences of lines from here
> and there, and then paste them all into a new buffer as one unit. 

I think the following macro will do

$collection[""] = ""
if (!("entry" in $collection))
    $collection["entry"] = ""
    

clip = get_selection()
if (clip == "") {
    $collection["entry"] = ""
}
else {
    $collection["entry"] = $collection["entry"] clip
}

(Calling it with no selection empties the variable so you can start
from new.)

If you need a visual feedback of the parts already added, you can
combine this macro with Uwe's rangeset macros found on Niki.

Of course, you need a second  macro to insert the clips like

$collection[""] = ""
if ("entry" in $collection)
    insert_string($collection["entry"])


Jörg


More information about the Discuss mailing list