uiua icon indicating copy to clipboard operation
uiua copied to clipboard

🛠️ Enhancement: Support Multiline Input in REPL

Open aeonik opened this issue 6 months ago • 4 comments

Hello, I’ve been working on patches for uiua-mode in Emacs to enable a more interactive development workflow with UIUA. While testing REPL integration, I noticed that UIUA’s REPL currently supports multiline input only via bracketed paste, which is only active when stdin is a TTY.

Specifically, the REPL reads a single line at a time using rustyline::Editor::readline, which means when running in non-TTY environments (like Emacs via comint, which pipes to stdin), multiline input does not work.

Here’s the relevant REPL implementation: https://github.com/uiua-lang/uiua/blob/84d9855f0f294fa995f0201e66a394294e6ebb28/src/main.rs#L1155-L1179

It would be a big improvement if UIUA’s REPL supported multiline input more explicitly — for example, by using a read_multiline loop like rlua, where empty lines or other delimiters indicate the end of an input block.

I’d be happy to test this if helpful. If I can find time, I might also attempt a prototype myself.

Also open to other suggestions or ideas.

Regards, Aeonik

aeonik avatar May 15 '25 21:05 aeonik

I'd accept a PR on this.

kaikalii avatar May 15 '25 21:05 kaikalii

I would like to work on this issue, if it is not picked up!

suraj-mandal avatar Sep 01 '25 05:09 suraj-mandal

Let me know if you do, I was thinking about taking a stab at it in a few weeks when I get more free time, but it would be my first time using Rust in a real project.

If you start before me, I will test your code, and provide feedback.

aeonik avatar Sep 01 '25 18:09 aeonik

Sure.. I will give it a try.. And let you know. Thanks

suraj-mandal avatar Sep 01 '25 18:09 suraj-mandal