[code] Re: [textadept] Working with clipboard

From: Qwerky <mr.qwerky.att.gmail.com>
Date: Sat, 14 Sep 2019 18:10:23 -0600

My working theory is that `buffer.selection_is_rectangle`, which is
read-only, is used to keep track of whether or not the selection is
rectangular, and controls how the text is pasted.  And further, that it
is being reset by `buffer.copy_text()`, so that even though the text was
originally selected as rectangular, after using `buffer.copy_text()`, it
will always be pasted as stream.  Since `buffer.selection_is_rectangle`
is read-only, I'm not sure how to work around this.  Does this theory
sound correct?

qwerky

On 2019-09-14 15:10, Qwerky wrote:
>
> Sorry, just a slight correction below:  the gmatch uses a capture:
> gmatch('(.-)\n') (the original message left out the capture).
>
> Hi Mitchell,
>
> What is needed to make use of buffer.copy_text(), to write text to the
> clipboard?  I've used `cliptext = ui.clipboard_text` to read the
> clipboard text to a string, and then `for line in
> cliptext:gmatch('(.-)\n') do` to read the lines of text from the
> string into a table.
>
> After that, `cliptext = table.concat(cliplines, '\n')` to join the
> table lines, and `buffer.copy_text(cliptext)` to write that string
> back to the clipboard.
>
> Although this text looks the same on the clipboard, when it is pasted
> into some other text, the result is not the same as pasting the
> original clipboard text into some other text.  Specifically, when the
> original text is rectangular, and is pasted into some other text, it
> pastes each line into succeeding lines of the other text.  But after
> the above operation, the text is pasted as a group of lines at a
> single place, rather than individual lines going into succeeding lines
> of the receiving text.
>
> How can I keep the text rectangular after writing it back to the
> clipboard?
>
> qwerky
>

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sat 14 Sep 2019 - 20:10:23 EDT

This archive was generated by hypermail 2.2.0 : Sun 15 Sep 2019 - 06:37:41 EDT