Merge pull request #863 from Carreau/follow-focus

Follow focus while multiselect
This commit is contained in:
Min RK 2015-12-14 15:41:19 +01:00
commit 55bb4c4437
2 changed files with 12 additions and 4 deletions

View File

@ -183,14 +183,22 @@ define(function(require){
help: 'extend selected cells above',
help_index : 'dc',
handler : function (env) {
env.notebook.extend_selection_by(-1)
env.notebook.extend_selection_by(-1);
// scroll into view,
// do not call notebook.focus_cell(), or
// all the selection get thrown away
env.notebook.get_selected_cell().element.focus();
}
},
'extend-selection-below' : {
help: 'extend selected cells below',
help_index : 'dd',
handler : function (env) {
env.notebook.extend_selection_by(1)
env.notebook.extend_selection_by(1);
// scroll into view,
// do not call notebook.focus_cell(), or
// all the selection get thrown away
env.notebook.get_selected_cell().element.focus();
}
},
'cut-cell' : {

View File

@ -607,7 +607,7 @@ define(function (require) {
* @return {Cell} The selected cell
*/
Notebook.prototype.get_selected_cell = function () {
var index = this.get_selected_cells_indices();
var index = this.get_selected_index();
return this.get_cell(index);
};
@ -711,7 +711,7 @@ define(function (require) {
this.get_cell(sindex).unselect(moveanchor);
}
if(moveanchor){
this.get_cell(this.get_anchor_index()).unselect(true);
this.get_cell(this.get_anchor_index()).unselect(moveanchor);
}
var cell = this.get_cell(index);
cell.select(moveanchor);