Page 2 of 2

Re: Reflow Line Breaks by External Tool

Posted: 27.08.2024 09:42
by main Alexey
I added macro {SelectionAsTemp}. plugin is updated.
please test it, my test with "echo {SelectionAsTemp}" (echo is program on linux) works ok.

Re: Reflow Line Breaks by External Tool

Posted: 03.09.2024 21:24
by Random Void User
Python's subprocess module can feed an external process stdin. This tutorial uses a dummy process that prints stdin. Could this technique somehow use {SelectedText} without making a temp file?

Code: Select all

import subprocess
import sys

result = subprocess.run(
    [sys.executable, "-c", "import sys; print(sys.stdin.read())"], input=b"underwater"
)

Re: Reflow Line Breaks by External Tool

Posted: 04.09.2024 04:41
by main Alexey
the python sample for selected-text is:

Code: Select all

import cudatext as app
sel = app.ed.get_text_sel()
print(sel)
how can I help more?

Re: Reflow Line Breaks by External Tool

Posted: 04.09.2024 19:29
by Random Void User
main Alexey wrote: 27.08.2024 09:42 I added macro {SelectionAsTemp}. plugin is updated.
please test it, my test with "echo {SelectionAsTemp}" (echo is program on linux) works ok.
Yes it works, thank you. I often work with unsaved documents, so the function text2temp in py/cuda_exttools/cd_exttools.py created a file called "_sel." for lack of naming tags. I will post separately about temp files in general.

I will play around with these ideas, thanks again for your quick feedback and tool updates.