Closed IndianBoy42 closed 11 months ago
Hello,
That sounds like a pretty cool workflow!
You'll need to use bracketed paste to get this working:
\cc
to clear euporie's input box before sending anything\x1b[200~
before your code;\x1b[201~
after your code;\x1b[13;5u
to run the code (Ctrl-Enter). \x1b[13;5u
will always run whatever is entered, whereas \r
will only run what is entered if it passes the kernel's code-completeness check.
For example:
kitty @ send-text --all --exclude-active '\cc\x1b[200~print(123)\nprint(456)\x1b[201~\x1b[13;5u'
I hope that you get it working!
Thanks for the tip about bracketed paste! that works great.
You seem pretty knowledgeable so can I ask, is there a good utility/library for converting keypresses into those csi/escape codes? or somewhere to learn all the details necessary to make one myself?
The VT100 user guide always makes a nice bit of light reading: https://vt100.net/docs/vt100-ug/chapter3.html#S3.3
There's also a wikipedia page on control-codes which might be a bit more accessible: https://en.wikipedia.org/wiki/C0_and_C1_control_codes
You might want to read the wikipedia page on ansi escape sequences first for a bit of background: https://en.wikipedia.org/wiki/ANSI_escape_code#Fe_Escape_sequences
Here's a couple of pages on modern terminal keyboard input: http://www.leonerd.org.uk/hacks/fixterms/ https://sw.kovidgoyal.net/kitty/keyboard-protocol/
If you run stty raw -echo; cat -v
, your terminal will print escaped key-press escape sequences.
I am trying to use euporie-console to have a nice graphical interactive python repl next to my editor (neovim).
I tried to use the Kitty terminals
kitty @ send_text
to send selected code to the terminal thateuporie-console
is running in, but I am having some problem with newlines. sending\r
acts like hitting enter which starts running the code but the next line is already sent and simply gets appended to the current line. And somehow euporie ends up trying to run this concatenated line, resulting in a syntax errorends up being sent as
Is it possible to have newlines in a long sequence of text be handled properly? Text after a
\r
but before the current line has actually started finished executing should go into a new line, ideally in the same chunk