-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
REPL: add an Option type to handle REPL options #23637
Conversation
Thanks for tackling this! As an alternative to |
It was previously not practical to disable the "align" feature of backspace: overwriting the '\b' binding with: `'\b' => (s,o...) -> Base.LineEdit.edit_backspace(s, false)` worked to a certain extent, but for example it was disabling the feature that '\b' must get you out of shell/help mode. A new experimental Options type is introduced here, which is meant to conveniently allow users to pass options controlling the REPL behavior. For example: atreplinit() do repl repl.options = Base.REPL.Options(backspace_align = false) end
e3a59d7
to
0245e2e
Compare
It may work, but a dedicated type is convenient to encode the defaults, and for data validation (check that an option passed by the user really exists, and make it easier that some options are made compatible, e.g. |
I will merge for now. The exact API doesn't have to be set in stone, but it responds to a need, and I would like be able to include more configuration options in follow-up PRs. |
Thanks! |
Just FYI, I've added REPL start-up plotting at http://users.elis.ugent.be/~tbesard/julia/repl.html and it looks like this PR has regressed REPL start-up user time with ~20%. |
I've really no idea why this would be so... what command can I run to benchmark the REPL start-up time? When I run (EDIT: nice graphs BTW!) |
I use (something like) this horrible script: https://gist.github.com/maleadt/901833b0317570230e88a5868963fa05 |
Maybe the |
Ok thanks to both of you, I will investigate when I can (on travel now). |
It was previously not practical to disable the "align" feature
of backspace (#22939): overwriting the '\b' binding with:
'\b' => (s,o...) -> Base.LineEdit.edit_backspace(s, false)
worked to a certain extent, but for example it was disabling
the feature that '\b' must get you out of shell/help mode.
A new experimental Option type is introduced here, which is
meant to conveniently allow users to pass options controlling
the REPL behavior. For example:
Also the
Options
alternative is offered to setup theextra_repl_keymap
(andhascolor
), instead of using the less directsetup_interface
(but no more complicated though). Eventually, probably only one way should be supported. We could even have the following simplified API for simple but common needs:I didn't document this yet, until this is approved or becomes less experimental.
cc. @vtjnash who had asked me how to disable
backspace_align
.