[code] [textadept] Working with clipboard

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

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 - 17:10:18 EDT

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