From dc3c98b8cfbf7fd7e3185c7a2d87b2c0e5c0047b 2014-03-17 23:21:23 From: Paul Ivanov Date: 2014-03-17 23:21:23 Subject: [PATCH] restore master behavior up arrow at the top line first goes to char 0, and only goes to the cell above if already on char 0. Same with down arrow on the bottom line: transition cursor to the end of the line, and only go down a cell if already at the end of the last line. this makes for an unhappy experience in code-mirror's vim mode for j and k keys, but we'll fix that in the next commit --- diff --git a/IPython/html/static/notebook/js/cell.js b/IPython/html/static/notebook/js/cell.js index b1ccd39..344adcd 100644 --- a/IPython/html/static/notebook/js/cell.js +++ b/IPython/html/static/notebook/js/cell.js @@ -281,7 +281,7 @@ var IPython = (function (IPython) { Cell.prototype.at_top = function () { var cm = this.code_mirror; var cursor = cm.getCursor(); - if (cursor.line === 0 && cm.findPosV(cursor, -1, 'line').hitSide) { + if (cursor.line === 0 && cursor.ch === 0) { return true; } else { return false; @@ -295,7 +295,7 @@ var IPython = (function (IPython) { Cell.prototype.at_bottom = function () { var cm = this.code_mirror; var cursor = cm.getCursor(); - if (cursor.line === (cm.lineCount()-1) && cm.findPosV(cursor, 1, 'line').hitSide) { + if (cursor.line === (cm.lineCount()-1) && cursor.ch === cm.getLine(cursor.line).length) { return true; } else { return false;