-
Notifications
You must be signed in to change notification settings - Fork 17
Implement multi-cell selection #151
Conversation
blink1073
commented
Apr 6, 2016

src/cells/model.ts
Outdated
| private _tags = ''; | ||
| private _name = ''; | ||
| private _tags = '{}'; | ||
| private _name = '{}'; |
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.
Should the default _name be '{}' or '""'? The empty string makes more sense to me.
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.
It can't be empty, since that causes the JSON.parse() to fail, agreed that tags should be [] though.
|
Metadata defaults updated in f583525 |
|
The selection logic is a bit more subtle in the current notebook. Essentially, only the cells between the active cell and the selection anchor are selected. So, for example, |
|
Understood, updating. |
|
Thanks. I'm excited to see this get in! |
|
Updated (see gif above). |
src/notebook/manager.ts
Outdated
| for (let i = 0; i < this.model.cells.length; i++) { | ||
| let cell = this.model.cells.get(i); | ||
| if (this.model.isSelected(cell)) { | ||
| count++; |
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.
Since we only care if any cell besides prev is selected, we can break as soon as we find one.
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.
Actually, under the current constraints (only a single contiguous selection), we only need to check to see if the cell before prev is selected.
In the future we'll probably have real (non-contiguous) multiple selection, and we'll have to rethink how all this logic works.
|
Movement without shift should deselect as well: |
|
Thanks, updated. |
a6b3011 to
9a4188c
Compare
|
|
||
| /** | ||
| * Select the next 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.
We shouldn't call this "select.." if we are deselecting cells. Maybe "activateNext" since it is changing the active cell?
|
@ellisonbg - it looks like @blink1073 has implemented the correct logic. I just wanted to loop you in for terminology: above/below vs prev/next, and select vs. active. I know we had a long discussion and specific definitions of these - I just don't remember exactly what they were :). I see in https://github.com/jupyter/notebook/blob/41d6da235cbf3bcf6d7f818e11a066e0fd12ff8b/notebook/static/notebook/js/actions.js#L14 that it seems like above/below is pretty interchangeable with prev/next. It seems like the actions in the current notebook indicate that the currently active cell is always selected, whereas we've distinguished between selected cells and the active cell (i.e., we can have no cells selected). Thoughts? |
|
We could use |
|
I also think we should standardize on |
|
Yes, I noticed you used both (above/below in the function title, prev/next as variables in the code) 😄 |
|
The existing Help Shortcuts dialog uses |
|
@blink1073: +1 to your current/selected semantics, though I think it's still okay to use |
|
I was thinking of it more like a "cursor position". |
|
Let's leave it as |
|
We can discuss tomorrow at the meeting. |
|
Good idea. On Thu, Apr 7, 2016 at 3:57 PM Steven Silvester notifications@github.com
|
|
Updated. |
|
Btw, with @Carreau we re-discussed jupyter/notebook#881 at the dev meeting. |
|
For the above/below and next/preview naming, please see the list of https://github.com/jupyter/notebook/blob/master/notebook/static/notebook/js/actions.js#L65 We spent an entire day auditing those back in new york last fall with Also, as much as possible, please follow the command naming conventions On Thu, Apr 7, 2016 at 2:55 PM, Sylvain Corlay notifications@github.com
Brian E. Granger |
|
Can someone summarize how selected/active are currently being used in On Thu, Apr 7, 2016 at 10:16 PM, Brian Granger ellisonbg@gmail.com wrote:
Brian E. Granger |
|
active indicates the current cell (i.e., has edit focus, or command selected sets a selection property on the cell, and there can be more than On Fri, Apr 8, 2016 at 1:17 AM Brian E. Granger notifications@github.com
|
|
As it stands, the "active" cell is considered selected, as in |
457a0a9 to
145dcec
Compare
|
Thanks for clarifying, @blink1073 |
|
A fresh checkout of the repo, plus the "command line instructions" above to merge this into master, gives this when running |
|
Here are the conflicts I have when I install: |
|
Are you using node 5? |
|
Nope, 4.2.4. On Fri, Apr 8, 2016 at 7:56 PM Steven Silvester notifications@github.com
|
|
Let me try rebasing, Darian had patched something this morning. |
145dcec to
0c7995f
Compare
|
Rebased. |
|
I'm also looking at merging your jupyter-js-ui PR and upgrading On Fri, Apr 8, 2016 at 8:11 PM Steven Silvester notifications@github.com
|
|
I get the same errors with the rebased branch. It still looks to me like there is a dedupe-type problem. |
|
Hmm, you can either upgrade to node 5 or we can wait for |
|
I'm going to hammer on this for a bit. The error clearly indicates there are some mismatched version numbers that are causing duplication. |
|
Try running |
|
Actually, you may have to nuke |
|
I've been killing node modules every time. I'll try with the updated On Fri, Apr 8, 2016, 20:58 Steven Silvester notifications@github.com
|
|
All right, trying with node 5.10.1 worked fine, so I'll merge this and keep digging about the problem on node 4.x. Thanks! |