Stream: compiler development

Topic: REPL newline control sequence


view this post on Zulip Brian Carroll (Sep 09 2023 at 11:06):

To enter a newline in the CLI REPL we are using the sequence: ctrl-v + ctrl-j
This feels unfamiliar and strange to me, I've never seen it anywhere else. But maybe it's familiar to other people.
I used ctrl-Enter for the web REPL, because I've seen that in lots of places (including this Zulip chat window!)
Does anyone know why we picked this sequence?
Does anyone have opinions on it?
Should we make both REPLs have the same sequence? Which one?

view this post on Zulip Anton (Sep 09 2023 at 11:42):

The strange Ctrl-v+Ctrl-J was partly due to https://github.com/kkawakam/rustyline/issues/653.
We do try to be smart about it, if you hit enter on an incomplete expression we create a new line instead of trying to pass it to the repl.
But there still probably are cases where you have complete expression but still want a new line. Because of the linked issue we can't do Ctrl+Enter or Shift+Enter, but I think we could do Ctrl+n for example.

view this post on Zulip Brian Carroll (Sep 09 2023 at 12:08):

OK. That's a pity. The web doesn't have this issue though.
So we can either use the same key combo as the CLI to be consistent with that. (Good for people who are very used to the CLI REPL)
Or keep the ctrl-Enter to be consistent with... everything else. (Good for newcomers or Roc users who don't use the CLI REPL much)

view this post on Zulip Anton (Sep 09 2023 at 12:26):

I'd be ok with allowing two combos to do the same thing to get a best of both worlds :)

view this post on Zulip Brian Carroll (Sep 09 2023 at 12:33):

Cool, that's what I was thinking too. We already print out instructions in the CLI one and I'm going to add that to the web one too.

view this post on Zulip Richard Feldman (Sep 09 2023 at 16:24):

yeah having them be different makes sense to me! :+1:


Last updated: Jul 06 2025 at 12:14 UTC