-------- Original message -------- From: Phil Thompson <[email protected]> Date: 6/17/18 04:03 (GMT-08:00) To: Scott Bloom <[email protected]> Cc: [email protected] Subject: Re: [QScintilla] Multiline selection text replacement
On 15 Jun 2018, at 6:27 pm, Scott Bloom <[email protected]> wrote: > > I would like to replace a multiline “rectangle” selection, with new text, > separate text per line. > > What I have done so far, is to create a string separated by the editors > “eol”. It was a guess, based on ::selectedText() returning a similar string > when multiple selections exist. > > But when calling ::replaceSelectedText, it drops the whole text at the last > selection (the primary selection according to the docs) > Simple example: > > Line [text 1] > Line [text 2] > Line [text 3] > > Where the [] represent a 3 line multi-line selection. > > int numSelections = SendScintilla( SCI_GETSELECTIONS ); > QString txt > for( int ii = 0; ii < numSelections; ++ii ) > txt += QString(“Line%1\r\n” ).arg( ii ); > replaceSelectedText( txt ); > > I would like to have > Line [Line0] > Line [Line1] > Line [Line2] > > What I get is > Line > Line > Line Line0 > Line1 > Line2 > > Any thoughts on how to implement this? Does SCI_SETMULTIPASTE help? Phil == Not at all.what I was able to do was the following. Get the start and end of each individual selection using the get selection n. Then I clear the selection, Then I loop over the list of selections I created backwards, and create a new selection one at a time, and replace the appropriate texr
_______________________________________________ QScintilla mailing list [email protected] https://www.riverbankcomputing.com/mailman/listinfo/qscintilla
