Keno / REPL.jl

Pure-julia REPL implementation
Other
3 stars 4 forks source link

Show ; and ? in shell/help mode. #29

Closed ivarne closed 10 years ago

ivarne commented 10 years ago

I do not like that you hide the ? and ; characters when switching to help and shell mode.

The first two concerns could be fixed without showing the characters though.

Keno commented 10 years ago

I thought about this quite a bit when I originally introduced those, and I came to the conclusion to not show them.

When I arrow up to older lines, the REPL does not remember the type of the command.

I know. This is intentional, but I don't feel particularly strongly about it. My original reason was the following: Say I type a command and I get the arguments wrong, so I want to look at the help. With this approach that's two keystrokes (? up), but maybe changing this and people using (up ^A ?) instead would be better.

If the characters are shown, it is obvious that you can switch back to Julia mode by using bakcspace. Now I can not figure out how to switch back to Julia mode. For screenshots it would be better if the character pressed to switch mode stayed on the screen. Demonstrations would also be better, if everything show up on the screen.

These are fair points, but then again it's pretty easy to discover and I don't think there will be problems.

ivarne commented 10 years ago

Yes, I know this is a question about taste, and does not cause important problems. We will see if others have opinions.

ivarne commented 10 years ago

Hey! Now going back to julia> mode from shell> and help> with backspace works. That explains your rather short response to my (badly formulated) request to add the functionality. I am sure it did not work earlier today, but I have not updated since I tried so it is strange.

Keno commented 10 years ago

Hey! Now going back to julia> mode from shell> and help> with backspace works. That explains your rather short response to my (badly formulated) request to add the functionality. I am sure it did not work earlier today, but I have not updated since I tried so it is strange

Oh, for me that has always worked! Sorry, I missed that in your original post!

StefanKarpinski commented 10 years ago

I think it would be helpful if esc also broke you out of a submode. Keeping the mode when scrolling through history would be a better experience, IMO, but maybe hitting escape with text on the line changes modes?

Keno commented 10 years ago

esc is tricky because it sends a literal \e which is also the start of the escape sequences. Readline does it via timing, but I think just checking whether there are any more bytes in the buffer would work as well.

StefanKarpinski commented 10 years ago

I'm guessing that either one would be fairly reliable, largely because esc is so far in its own corner.

StefanKarpinski commented 10 years ago

For what it's worth, I'm not sure why, but I find the psychological effect of the fact that the ; and ? don't show up and the prompt changes instead to be profound. I know it's a trivial difference, but somehow it makes typing commands into the repl feel almost as powerful as using a real shell. It's quite lovely. The semicolon was a good choice.

ivarne commented 10 years ago

I agree on the estetics and the feel of it, but I still think that the commands are easier to learn when they are shown. For that issue a equally good solution might be just to change the prompt to ;shell> and ?help>.

@StefanKarpinski what do you think about the history remember type of command issue?

StefanKarpinski commented 10 years ago

It absolutely must remember the command type. The fundamental premise of command history is that you can press the up key and hit return and do the same thing you just did again.

StefanKarpinski commented 10 years ago

Honestly, I think it's completely fine for the REPL to just behave like there's an invisible semicolon/questionmark at the beginning of those lines. That implies that history remembers the command type and that the history file should actually contain the literal characters, even if they're not shown.