Skip to content
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: transpose/indent multiple lines at once when highlighted #24938

Merged
merged 2 commits into from
Dec 8, 2017

Conversation

rfourquet
Copy link
Member

No description provided.

@rfourquet rfourquet added the REPL Julia's REPL (Read Eval Print Loop) label Dec 6, 2017
@rfourquet rfourquet force-pushed the rf/repl/multiline-indent branch from dae3ea2 to 4ec8571 Compare December 6, 2017 10:29
@andyferris
Copy link
Member

@rfourquet I couldn't infer the functionality from the title, but I am curious. Do you have an example of what this does, or an issue or discussion to refer to?

@rfourquet
Copy link
Member Author

rfourquet commented Dec 8, 2017

Thanks for asking! I realize the tiltle must be quite opaque for anyone having not noticed the introduction of two recent features (pretty much everyone I guess 😉 ), at the intersection of which this PR lies:

  1. you can indent the current line left/right with Alt-ArrowLeft and Alt-ArrowRight (REPL: indent line left-right with Meta-Arrow{Left,Right} #24726), and 1'. you can transpose the current line with the one above/below with Alt-ArrowUp and Alt-ArrowRight (REPL: implement transpose current line with line above/below #24687).

  2. there is always a "region" in the input area delimited by the "mark" and the current position (REPL: implement a kill ring #23377); the mark is at position 0 by default, and can be set by Ctrl-Space; this region can be "copied" for example with Alt-w (and then pasted with C^y). Now, a region can be "activated", which is indicated by it being "highlighted", either repeating by Ctrl-Space twice, or with "shift-Arrow" keys, which is more known as "shift-selection" (REPL: enable visual selection #24725). This is still experimental, but the goal was to make the concept of region more discoverable (shift-selection is common in GUIs), and to allow some commands to have two modes of operations "simple" and "region", like this PR does. Another example would be having "backspace" delete the whole region when it's active (PR to come).

@andyferris
Copy link
Member

Cool, thanks, nice features! I love the repl but for creating long functions it was tedious. This suite of changes should help enormously!

I’m curious about some of the keybindings - are these inspired by something?

(PS providing refs to those previous PRs would aid in navigabity. Thanks for taking your time to explain)

@rfourquet
Copy link
Member Author

Thanks!

I’m curious about some of the keybindings - are these inspired by something?

The Ctrl-Space binding is inspired by emacs and readline, the Ctrl-Space twice by emacs (and more generally the concept of "active region"), (IPython has it too), the shif-selection by pretty much all GUIs, the alt-arrow keys are just ad-hoc, the bindings were free! but still it makes some sense: when alt is pressed, you can play with the arrow keys, and see your line or region moving accordingly. These bindings could be reclaimed though, if a better functionality pops in.

I updated the post above with references to PRs.

@rfourquet rfourquet force-pushed the rf/repl/multiline-indent branch from 4ec8571 to d787423 Compare December 8, 2017 10:53
@rfourquet rfourquet merged commit 3719905 into master Dec 8, 2017
@rfourquet rfourquet deleted the rf/repl/multiline-indent branch December 8, 2017 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants