Skip to content

Commit

Permalink
Merge pull request #765 from marceloramires/master
Browse files Browse the repository at this point in the history
Fixing backspace on multiple selection bug
  • Loading branch information
minrk committed Dec 1, 2015
2 parents f78e3f0 + 6692ea7 commit b2e3382
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion notebook/static/notebook/js/codecell.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ define([
*/
CodeMirror.commands.delSpaceToPrevTabStop = function(cm){
var from = cm.getCursor(true), to = cm.getCursor(false), sel = !posEq(from, to);
if (!posEq(from, to)) { cm.replaceRange("", from, to); return; }
if (sel) {
var ranges = cm.listSelections();
for (var i = ranges.length - 1; i >= 0; i--) {
var cur = ranges[i].head;
cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1));
}
return;
}
var cur = cm.getCursor(), line = cm.getLine(cur.line);
var tabsize = cm.getOption('tabSize');
var chToPrevTabStop = cur.ch-(Math.ceil(cur.ch/tabsize)-1)*tabsize;
Expand Down

0 comments on commit b2e3382

Please sign in to comment.