Skip to content

Commit 967f2c0

Browse files
committed
Added action to select all cells with Ctrl-A
1 parent 9b597a9 commit 967f2c0

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

notebook/static/notebook/js/actions.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,15 @@ define([
298298
env.notebook.get_selected_cell().element.focus();
299299
}
300300
},
301+
'select-all' : {
302+
cmd: i18n.msg._('select all'),
303+
help: i18n.msg._('select all cells'),
304+
help_index : 'de',
305+
handler : function (env) {
306+
env.notebook.select_all();
307+
env.notebook.get_selected_cell().element.focus();
308+
}
309+
},
301310
'cut-cell' : {
302311
cmd: i18n.msg._('cut selected cells'),
303312
help: i18n.msg._('cut selected cells'),

notebook/static/notebook/js/keyboardmanager.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ define([
145145
'shift-j': 'jupyter-notebook:extend-selection-below',
146146
'shift-up': 'jupyter-notebook:extend-selection-above',
147147
'shift-down': 'jupyter-notebook:extend-selection-below',
148+
'cmdtrl-a': 'jupyter-notebook:select-all',
148149
'x' : 'jupyter-notebook:cut-cell',
149150
'c' : 'jupyter-notebook:copy-cell',
150151
'v' : 'jupyter-notebook:paste-cell-below',

notebook/static/notebook/js/notebook.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,12 @@ define([
835835
});
836836
};
837837

838+
839+
Notebook.prototype.select_all = function(){
840+
this.select(0, true);
841+
this.select(this.ncells()-1, false);
842+
};
843+
838844
Notebook.prototype._contract_selection = function(){
839845
var i = this.get_selected_index();
840846
this.select(i, true);

0 commit comments

Comments
 (0)