jonsequitur / dotnet-repl

A polyglot REPL built on .NET Interactive
MIT License
736 stars 37 forks source link

The keyboard shortcuts are weird and unlike every other popular REPL out there #69

Open pavelbraginskiy opened 2 years ago

pavelbraginskiy commented 2 years ago

I understand some people may have already gotten used to the dotnet-repl way, but is it at least possible to make it configurable?

jonsequitur commented 2 years ago

Up and down let you move between lines for multiple-line submissions:

image

I'd be happy to see the keyboard shortcuts made configurable. It should be pretty simple to do if I can find the time.

What OS are you using?

pavelbraginskiy commented 2 years ago

I'm on Linux. I really want to like dotnet-repl, it looks awesome and generally works how I want it to work, but having to unlearn my muscle memory from every other shell really makes using it difficult.

commonquail commented 2 years ago

I'm an avid dotnet-repl-on-Linux user. I would have phrased this report differently but I share the sentiment: dotnet-repl's interactivity is pretty jarring in a GNU Readline context. I would consider this not a bug so much as possibly-incidental Windows centrism, and a change more like a concession to those used to GNU Readline. Equivalently, GNU Readline is positively baroque elsewhere. Either way, though, I would personally quite like to have GNU Readline support.

I would add, though, that it is impossible to implement C-c correctly in a REPL. When implemented as specified and as currently working, that is as interrupt, the user has to restart the REPL. This is even worse in dotnet-repl where that also means a complete environment tear-down; I make this mistake on a weekly basis. When implemented as suggested, erasing the current line, well, that breaks SIGINT. python3 does the latter but also reports it to the user as a KeyboardInterrupt event, which is something; sqlite3 terminates after the third (?) C-c only. mysql terminates immediately, or used to at least, and it's absolutely maddening.

I see there is https://github.com/tonerdo/readline but I know nothing about it.

jonsequitur commented 2 years ago

The readline library that dotnet-repl uses is Radline, although the keyboard settings are controlled by dotnet-repl.

I'm open to changing them and it would also probably be pretty simple to allow customization.

IAALAI commented 1 year ago

customization

If customization is allowed, it will be great and better!

lamuertepeluda commented 1 year ago

I use macOS and the problem with Ctrl+Up/Ctrl+Down is that they conflict with System settings for the fancy macOS desktop system apps (Mission Control & Application Windows)... Having a more nodejs-like or python-like REPL keyboard shortcuts would be more familiar for most devs IMHO, especially those approaching C# for the first times.
But, generally speaking, it would be enough to allow some customization.
What about a global .json or .xml settings file?

jonsequitur commented 1 year ago

Making these customizable would be ideal. I haven't had the time to do it but would be happy to help someone with a PR.

tats-u commented 1 year ago

@jonsequitur How can I cancel the current expression or statement being input? There is no way currently. It must be able to be done by Ctrl + C.

tbolon commented 9 months ago

I suggest that when the prompt is still on a single line, Up and Down should be recognized as history navigation shortcut. Ctrl+Up and Ctrl+Down could be required only when there are multiple lines.