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
[WIP] Prototype to fix Shift-J/K selection with anchor and cursor #708
Conversation
ping @ellisonbg , @jdfreder |
Ok, styling is a bit better, I did 1 random user testing. First key thought for:
|
I love the little arrows, and if it also means it solves our hotkey problems by making right/left arrow keys the natural winner, +1 |
3 useful set of keybindings: var c = IPython.keyboard_manager.command_shortcuts;
// A
c.add_shortcut('Ctrl-space','jupyter-notebook:toggle-cell-marked')
// B
c.add_shortcut('minus','jupyter-notebook:unmark-selected-cells')
c.add_shortcut('+','jupyter-notebook:mark-selected-cells')
// C
c.add_shortcut('left','jupyter-notebook:unmark-selected-cells')
c.add_shortcut('Shift-left','jupyter-notebook:unmark-selected-cells')
c.add_shortcut('right','jupyter-notebook:mark-selected-cells')
c.add_shortcut('shift-right','jupyter-notebook:mark-selected-cells') I don't like A. |
I don't understand the motovation for this PR. Master currently has a very clean set of abstractions that encode the idea of a cursor or active cell (selected) and a set of cells that are the target of an action (marked). These two abstractions are needed because of how selected is inextricably tied to the browsers notion of focus. The only issue we have right now in master is the awkward functioning of the shift-j/k keyboard shortcuts and the This PR introduces a third abstraction (soft selected) that conflates and confuses all of this in a really awkward way. And the changes are not just implementation details that fix the shift-j/k shortcuts. It mixes it with new concepts and interactions in the UI that are overly complex. From the beginning of when @jdfreder and I started to talk about the marked cell concept, I was aware we would have to think carefully about how shift-j/k work. My design of the marked cells included background threads thinking about it. I see two ways of fixing it:
|
I honestly do not know how to do shift-J/K with a state machine correctly. And again, if it's a state machine I do not know how we will describe to user how it works. And personally I see a leakage of abstraction between marked state and selected state. Which is better now that the selected cell is implicitly marked. This is my attempt at fixing it. In all normal user UI, not only would Shift-J/K/Up/down work with anchor/cursor, but once you have a selection moving the cursor deselect all. Which is not what the notebook does. Which we try to work around with indicators of the number of marked cell. For me the marked marked state is useful but is the complicated part of the API. It is the state-full part that need the user to keep in it's mind. In my opinion, there are many more user just need contiguous select than user that need marked cells. Anyway, this is a PR to see what can be done, I'm ok for it to not be merged, |
I definitely prefer this one. |
This is probably the best idea for now, since it seems there is a general disagreement on the behavior and falling back to providing neither is simple. Although @Carreau I still like the arrows and the left/right kb shortcuts instead of toggle. Also, implementation details aside, the head/anchor notion of selection is definitely the most intuitive for the unexpecting user. |
Thanks @jdfreder. Another option would be for j,k,up,down and other "just-select* action to by default to unmark all. Not with shift of course. I think that would be less surprising. |
Just want to point out that if you remove the shift-j/k shortcuts and only have toggling for marking cells, merging two cells becomes really onerous:
as opposed to
which is already two keystrokes more than it used to be before multi-selection was added. |
Note that you can leave the second |
one things to fix: The css make the tooltip disapear. I'm worked a bit with both master and this branch this week end. ON master, I've been caught off guard many time by extra-cell being marked, leading to cell deletion and execution of things I was not expecting. I'me starting to lean toward -1 on multiple marking with the keyboard, I'm find with mouse+click to multiple-select, but I think any keyboard action should (after the action) reset the marked cell to all-unmarked (except Shift-J/K of course) |
I am not sure I understand the issue, can you clarify? Sent from my iPhone
|
I will say this - I do wonder if we should remove marking after any On Mon, Nov 9, 2015 at 11:34 AM, Brian Granger ellisonbg@gmail.com wrote:
Brian E. Granger |
Probably doesn't make sense to unmark on copy. |
I'm +1 on this.
I don't see why it doesn't.
Select a bunch of cell, merge them, J,J,J, DD : oops, deleted the merged cells. Split Cell, Down, Shift enter : oops , also executed |
Consistency with other programs, because copy doesn't affect selection / mark state in any program I can think of. |
Fair enough, Then do you agree that J/K alone should deselect all like in any other programs ? |
hmmm, good point. |
Um no, then how do you do discontiguous selections? On Mon, Nov 9, 2015 at 3:10 PM, Jonathan Frederic notifications@github.com
Brian E. Granger |
With the mouse. That's how most of the UIs of desktop browser works. Or that the point of my other PR with multiple selection and marking, where marking is an rare action that you do when you really need discontinuous selection, Also the discontinuous selection have weird semantics, like if you mark every other cell and merge, where is the merged cell inserted ? |
I don't understand. Everyday, for hours and hours each day, I use a UI (Gmail) that only has I agree that some actions should not work on discontiguous selections - On Mon, Nov 9, 2015 at 5:19 PM, Matthias Bussonnier <
Brian E. Granger |
this UI is disabled by default You have to enable it in your preferences.
I dont' say that marking is bad in general I completely understand the usage, though the manipulation you make in gmail are quite different from what you do in a notebook. Like in Gmail you cannot merge mails. j/x sequences to select N cells is twice the number of keystrokes that you need if using Shift-J, so I believe multiple selection is more useful that non-contiguous marking. I do understand the need of discontinuous marking, and I do not dismiss it's utility. I think that one of the possible solution is to have multiple selection.
I'm worried of the complexity involved here, and I would like to to reach 90% of users with 10% of the efforts. One of the reason I liked to videochat with you is to clarify the meaning of words selection/marking/soft_selection and so on and so forth, as most of the discussion are impaired by us using different term for same things, and same terms for different things. So let's try to clarify what action we want the user to be able to do, scenario that we think should not happend/are confusing (regardless of implementation) and look at various possible implementation. I'll open a google docs for that. |
I'm trying to list problematic use case here: https://ipython.hackpad.com/Multiple-selection-W7KzQxYqMZp |
ping @fperez |
Some updates after discussion with @fperez on tuesday. Shift-click now select a range, (I had to unbind |
Here is a prototype of the visual design from @cameronoelsen Adds MTD shadow on the selected cell, 3px wide multi-cell indicator. |
Wooohoooo, sorry, was busy for the last 2 days, will catch up this week-end ! |
wow, hadn't seen this had been merged, +1000 for this going in. Thanks everyone for all the hard work that went into making it happen! And cheers to that awesome gif ;) |
Hey all, I have a quick question... I know this is already merged, but the behavior I'm seeing on selection looks like this: which has no highlight at all, and is in fact quite different from where the discussion seemed to have converged. I'm running off master right now (commit caa23d0). Did things change post merge or did I miss anything elsewhere? It seemed we'd agreed that some kind of highlight was indeed what we wanted... |
Hmmm, that is the old behavior. You are either running 4.0.x stable or need On Sun, Dec 13, 2015 at 11:38 AM, Fernando Perez notifications@github.com
Brian E. Granger |
The most obvious reason would be that |
Very odd...
and that screenshot was after multiple cache dumps and page reloads. But OK, if you guys aren't seeing that, then I'll keep digging. As long as it's just me, carry on... ps - Brian, I'll ping you later today :) |
indeed... we should improve |
Ah, Brian helped me... JS newbie here... |
@fperez I would suggest you |
Ah, great! That's the flag I was looking for and couldn't remember... That stuff should be prominently in our dev docs/readmes to help people trying to run from source, and who aren't npm ninjas (like me :) |
btw, is that for the |
@fperez: Good point and something I've been meaning to do since I learned about the command myself! I've opened up and issue and will be looking at it later tonight. |
@fperez @captainsafia https://jupyter-notebook.readthedocs.org/en/latest/config.html and https://jupyter-notebook.readthedocs.org/en/latest/frontend_config.html should be helpful. And if they aren't, we can fix them ;) |
@willingc: Derp! Thanks for linking. Very useful. 👍 |
It's here in the docs but we can do better. It's also in the
Yes, or JSON config, of command line flag, as you wish. |
Sounds good, thanks so much folks! We are indeed getting better here, I really appreciate it :) |
And I apologize to all of you who have helped so much if, in my getting lost in some of our new complexity, I sometimes sound a bit impatient. Grumpy old man and all that... I will do better :) |
@fperez Thanks for sharing your experience honestly (and humbly). You have the benefit of knowing where to ask. Not every user will. Just to understand the root cause of the initial issue that you had @ellisonbg help with. You were installing and building the docs locally on your system and were getting errors. Which is a reasonable use case for end users that may do a git clone, want to build the docs locally, and try to do so before building the whole project and its dev environment locally. |
:) On Mon, Dec 14, 2015 at 4:51 PM, Carol Willing notifications@github.com
Brian E. Granger |
Thanks for happy grumpy cat :) But to clarify: no, it wasn't a doc build, it was trying to run the notebook itself from a git master checkout. But I forgot to run The behavior was thus rather confusing: at the command-line, a So, the summary is, you either:
Since I'm forgetful and I also find the npm build slow, I went for the latter... |
Wonderful, thanks!! |
We always appreciate feedback from new users ! (Only mildly joking) You can also nuke all your |
related to #707
Behold my unprecedented design skills.
Anchor is cyan, and cell in between anchor and cursor have purple border, just for demo purpose and visually track bugs.