lunduniversity / introprog

Teaching material for "Introduction to Programming using Scala" at Lund University, LTH. http://cs.lth.se/pgk/
140 stars 167 forks source link

include hint on how to force newline in REPL on Linux, Windows, Mac #725

Closed bjornregnell closed 1 year ago

bjornregnell commented 1 year ago

It is AltLeft+ENTER on Linux, which forces a newline, delaying evaluation of the input.

It seems to be Option+Enter on MacOS?

It may be different on different terminals in Windows?

Can someone check how to to this on MacOS and Window both cmd, powershell, windows terminal, vs code terminal etc? And report by commenting on this issue

This should be explained early in the course on so people can learn how to master the REPL as soon as possible...

bjornregnell commented 1 year ago

Can someone check how to to this on MacOS and Window both cmd, powershell, windows terminal, vs code terminal etc? And report by commenting on this issue

I still need help on this from people with various setups. Anyone with (MacOS-x86 & MacOS-ARM | bash & zsh) | (Win10 & Win 11 | cmd & powershell & windowsTerminal & WSL & vscodeTerminal) please report which keyboard modifier to use to force new line and delay interpretation i REPL and state what system you are on and which setup you have here in the comments below.

It is AltLeft+ENTER on my Ubuntu 22.04 in Terminal.

Husenap commented 1 year ago

I tested it on Windows 11 and WSL 2

Windows 11 (powershell och cmd): Left Alt + Shift + Enter WSL 2: Left Alt + Shift + Enter VSCode in Windows 11: Left Alt + Enter VSCode in WSL 2: Left Alt + Enter

andrephilipsson commented 1 year ago

Tested on macOS (ARM) and it seems like only Esc + Enter works universally.

Option + Enter works in VCCode but not in the macOS default Terminal.app, while Esc + Enter works for both.

bjornregnell commented 1 year ago

Aha, it turns out that Esc+Enter also works in Linux Ubuntu 22.04 -- didn't know that! Would be good if someone with an old MacOS for x86 (Intel) could try it out.

bjornregnell commented 1 year ago

So after some investigation by @Husenap and @andrephilipsson it turns out that "pressing Esc and then releasing it before pressing Enter" works on all platforms, including the terminal inside VS Code on all platforms.

So the best solution is to first explain the platform independent method (and then as a side-note mention some platform specific ways perhaps).

bjornregnell commented 1 year ago

I have made a Slide here in w01 now: https://github.com/lunduniversity/introprog/commit/afc5b0b747fa2af9244130162795d7311131ff3f

Still left to do: Add detailed platform-specific info in Appendix C.4.2

bjornregnell commented 1 year ago

fixed Appendix C with https://github.com/lunduniversity/introprog/commit/2147ff351315a978eb4ac0d096c023f5abc82de6