-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Don't break user keyboard shortcut. #667
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
Conversation
I think this is a good idea. If we need to, we could throw a modifier key in front of the x,c,v to target marked cells instead of the selected cell. |
Do differentiate copy/cup/delete selected from marked cells. Bind the keyboard shortcut to the **old** behavior. This does not prevent us from rebinding later, but at least make things explicit.
bd36e29
to
59a1ddd
Compare
Ok, reworked. Should be ready. Need @jdfreder hawk eyes. |
env.notebook.select(index); | ||
} | ||
}, | ||
'copy-cell' : { | ||
'cut-marked-cell' : { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When talking about marked, it can be plural, so I'd cut-marked-cells
👀 looking some more |
return; | ||
} | ||
this._delete_cells(indices); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semicolon here too, since this is an assignment. When it becomes an ES6 class, we can get rid of the semicolons on the function definitions.
b7a0a37
to
4373453
Compare
|
||
Notebook.prototype._delete_cells = function(indices) { | ||
if(indices === undefined){ | ||
throw new Error('need indices to delete cells'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, why'd you split delete_cells
from _delete_cells
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The private one should always raise if no indices are given. The public one can do heuristics, that reduce the number of potential bugs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
ok, done looking |
is this ready to go? |
Pushed fixes. Travis is slow. |
I've killed a few builds on old commits. |
Also I'd like @ellisonbg to not give a -1 before merging. |
In the meantime I'll check it out and give it a test run. |
Seems to work as advertised! |
I have been using cell marking for the last week or so to prepare talks, I think if we allow multiple selection in any form, but don't bind the So, yes, initially -1 - but you knew that was coming :) I am open to a number of changes that will clarify the selected/marked idea:
This is not just about cut/copy/paste. Many other actions apply to multiple On Mon, Oct 26, 2015 at 3:25 PM, Matthias Bussonnier <
Brian E. Granger |
I agree with your point that it is more powerful, Though we cannot change keyboard shortcut in between minor releases. The changing keyboard shortcut is more annoying as a sequence of shortcut in 4.1 can lead to a different state than 4.0. (Merge leave cells in a marked state which influence later actions).
So user that have taken habits for the last 3 month with in a couple of minutes need to rewire their brain, and might not even be aware of that change. Especially since the actions that are affected are destructive (delete). I can see middle grounds though:
or,
Side note, I can update this PR so that default actions are still the same, but still get the API granularity of selected vs marked cell. Would that be more acceptable ? To rephrase where I stand, I am not against the new behavior. I am against changing the behavior of keyboard shortcuts in between 4.0 and 4.1. |
Ahh, thanks for the clarification. I agree with you that actions that don't involve marked cells should not Would you consider it a keyboard shortcut breakage if all previous keyboard On Mon, Oct 26, 2015 at 9:39 PM, Matthias Bussonnier <
Brian E. Granger |
Depends on which behavior, I can think of a few that would be ok. But probably not if you look at my other comment where this change in behavior is surprising and does unexpected actions. I would be ok for example for DD to refuse deleting if there where marked cells, but the selected cell was not one of the marked cell. Let's discuss that tomorrow. |
I wouldn't be so black and white about this, especially if it means sacrificing the user experience.
I think this is the best way forward, even if it means the shortcuts don't work as normal when things are marked. I think that's okay, because marked cells are a new context that hasn't existed pre 4.1.
I think the simpler, more intuitive behaviour would be for DD to delete the marked cells if they exist, and to otherwise delete the selected cell. |
You completely miss the point, that what they are doing now, and what cause the issue. Question A: What does DD does if the first cell of the notebook is selected ? Question B: I have the following notebook: How do I delete the selected cell ?
No if is not destructive, but here the same action on 4.0 and 4.1 can delete work. |
I must still be missing the point,
Deletes the first cell
Deletes the selected cell, unless there are marked cells somewhere on the page, even if out of view. |
Other than shift up/down (maybe we should remove this), it doesn't seem easy to accidentally mark cells. Therefor, I don't know why it is a surprise that DD acts on the marked cells and not the selected.
I could see this being a good compromise for now, and revisiting for 5.0 |
@jdfreder The issue is that users have been using
is very unintuitive to me. The cells that are being operated on are the ones I'm looking at. Since the few follows the selection around (not the marked cells), my first assumption would be that things like deleting cells operates on the one that I have selected, especially if the marked cells aren't even visible. To address the issue for now, I think the following two things will be sufficient:
|
Wrong, delete the first unless something else is marked. Now you need to explain what marked is.
You missed the question. A user have the following notebook and ask you what to do to delete. If you are teaching with the notebook to 40 people you need to look after, and have to scroll to 10 page to know wether DD will delete the selected cell or not, then there is a UI problem. If a user ask you how to delete a cell and you have to go through 1 3 page explanation on how to mark/unmark cell and why 2 user that have the same thing on screen have the same click on the same menu do 2 different things you have a UI problem. You cannot in a UI rely on hidden state. If the visible state is out of the view it is hidden state. |
I see where you guys are coming from, I agree, we should change the behavior before the release. @ellisonbg I'm starting to think that, fundamentally, decoupling the ability to mark from selection (DOM element focus) was not the right idea. Maybe we should have decoupled it only for command mode - because command mode shouldn't need elements on the page to be focused (user isn't inputting into CodeMirror). This would mean no need for marks, and everything could be multi-select (contiguous or not). It seems like the root of the confusion is the fact that there are now 2 modes of selection. How does GMail, and other applications like it, handle this? |
The Gmail UI changes when you "mark" a message. |
In gmail, if you're in the list view I believe you have to mark messages (check them) before you can do anything. So that would be equivalent to saying you can't do anything with the selection, but have to first mark any cells you want to mark. However, I don't know if we should follow that model because (1) in gmail they use checkboxes, which makes it really obvious what is selected and what isn't, (2) you are limited in the number of emails displayed at a time, while we do not limit the number of cells, so having things be off-screen is less of a problem in gmail, and (3) users are used to having the selection operate on cells, and modifying that would be a fairly major change. |
That wouldn't change a lot, you still have this difference between the "cursor" cell and the "marked" cell. it's always confusing as to know wether the actions affect marked or cursor. My take on that would be that all actions by default should affect |
I think like @jhamrick mentioned in #669 , if we make them look the same, |
👍 on operating on |
👍 as well, good summary, @jhamrick. |
Changes Unknown when pulling fe5d9fb on Carreau:actions-on-selected into ** on jupyter:master**. |
Changes Unknown when pulling fe5d9fb on Carreau:actions-on-selected into ** on jupyter:master**. |
I have updated Coveralls' settings to disable the comments again. |
Do differentiate copy/cup/delete selected from marked cells.
Bind the keyboard shortcut to the old behavior.
This does not prevent us from rebinding later, but at least make things
explicit.
Ping @ellisonbg, @jhamrick , @jdfreder
We cannot in default action sometime act on selected, sometime on marked.
I still think that the marked/selected distinction is wrong, and that default action should at least always act on selection.
Todo:
-marked-
to nothing selected.[ ] menubar buttonnot in menubarTo respond to @ellisonbg why shoud copy/delete be different than other action :
Right now copy/delete (and cut as cut is copy+delete) are the only actions that have heuristic to sometime act on selection and sometime act on marked cell.
So there are no reason to behave differently, hence they shoudl not have this heuristic.