##// END OF EJS Templates
Merge pull request #6565 from dsblank/patch-1...
Matthias Bussonnier -
r18034:4b34c944 merge
parent child Browse files
Show More
@@ -430,7 +430,7 define([
430 *
430 *
431 * @method get_cell
431 * @method get_cell
432 * @param {Number} index An index of a cell to retrieve
432 * @param {Number} index An index of a cell to retrieve
433 * @return {Cell} A particular cell
433 * @return {Cell} Cell or null if no cell was found.
434 */
434 */
435 Notebook.prototype.get_cell = function (index) {
435 Notebook.prototype.get_cell = function (index) {
436 var result = null;
436 var result = null;
@@ -446,7 +446,7 define([
446 *
446 *
447 * @method get_next_cell
447 * @method get_next_cell
448 * @param {Cell} cell The provided cell
448 * @param {Cell} cell The provided cell
449 * @return {Cell} The next cell
449 * @return {Cell} the next cell or null if no cell was found.
450 */
450 */
451 Notebook.prototype.get_next_cell = function (cell) {
451 Notebook.prototype.get_next_cell = function (cell) {
452 var result = null;
452 var result = null;
@@ -462,14 +462,12 define([
462 *
462 *
463 * @method get_prev_cell
463 * @method get_prev_cell
464 * @param {Cell} cell The provided cell
464 * @param {Cell} cell The provided cell
465 * @return {Cell} The previous cell
465 * @return {Cell} The previous cell or null if no cell was found.
466 */
466 */
467 Notebook.prototype.get_prev_cell = function (cell) {
467 Notebook.prototype.get_prev_cell = function (cell) {
468 // TODO: off-by-one
469 // nb.get_prev_cell(nb.get_cell(1)) is null
470 var result = null;
468 var result = null;
471 var index = this.find_cell_index(cell);
469 var index = this.find_cell_index(cell);
472 if (index !== null && index > 1) {
470 if (index !== null && index > 0) {
473 result = this.get_cell(index-1);
471 result = this.get_cell(index-1);
474 }
472 }
475 return result;
473 return result;
@@ -480,7 +478,7 define([
480 *
478 *
481 * @method find_cell_index
479 * @method find_cell_index
482 * @param {Cell} cell The provided cell
480 * @param {Cell} cell The provided cell
483 * @return {Number} The cell's numeric index
481 * @return {Number} The cell's numeric index or null if no cell was found.
484 */
482 */
485 Notebook.prototype.find_cell_index = function (cell) {
483 Notebook.prototype.find_cell_index = function (cell) {
486 var result = null;
484 var result = null;
General Comments 0
You need to be logged in to leave comments. Login now