From ed22684ef239e227693bbf9ab05904a38bf53262 Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Tue, 28 May 2013 18:17:12 +0200 Subject: [PATCH 1/5] Use different threshold for (auto)scroll in output Allow, in particular to switch to scolling for longer input (or disable it) by still keeping the possibility to manually toggle the output to scroll. --- .../notebook/static/notebook/js/notebook.js | 2 +- .../notebook/static/notebook/js/outputarea.js | 77 +++++++++++++++++-- 2 files changed, 71 insertions(+), 8 deletions(-) diff --git a/IPython/frontend/html/notebook/static/notebook/js/notebook.js b/IPython/frontend/html/notebook/static/notebook/js/notebook.js index fb6cdf8ea..80ac53622 100644 --- a/IPython/frontend/html/notebook/static/notebook/js/notebook.js +++ b/IPython/frontend/html/notebook/static/notebook/js/notebook.js @@ -1242,7 +1242,7 @@ var IPython = (function (IPython) { for (var i=0; i Date: Tue, 28 May 2013 21:25:21 +0200 Subject: [PATCH 2/5] improve js documentation --- .../notebook/static/notebook/js/outputarea.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/IPython/frontend/html/notebook/static/notebook/js/outputarea.js b/IPython/frontend/html/notebook/static/notebook/js/outputarea.js index 2e780dee0..d3bb0c67f 100644 --- a/IPython/frontend/html/notebook/static/notebook/js/outputarea.js +++ b/IPython/frontend/html/notebook/static/notebook/js/outputarea.js @@ -169,7 +169,7 @@ var IPython = (function (IPython) { * typically when new outputs are added. * * Behavior is undefined if autoscroll is lower than scroll_threshold, - * unless it is < 0 then autoscroll will never be triggerd + * unless it is < 0, in which case autoscroll will never be triggered * * @property auto_scroll_threshold * @type Number @@ -180,8 +180,8 @@ var IPython = (function (IPython) { /** - * Defautl value for minimal length for output are to be able to switch to - * scroll mode + * Lower limit (in lines) for OutputArea to be made scrollable. OutputAreas + * shorter than this are never scrolled. * * @property scroll_threshold * @type Number @@ -192,14 +192,17 @@ var IPython = (function (IPython) { /** - * Scroll OutputArea if height supperior than a threshold. * - * Treshold is exprimed as a number of lines, fallback to a (configurable) default. + * Scroll OutputArea if height supperior than a threshold (in lines). * - * Negative or null (0) threshold will prevent the OutputArea ever to scroll. + * Threshold is a maximum number of lines. If unspecified, defaults to + * OutputArea.scroll_threshold. + * + * Negative or null (0) threshold will prevent the OutputArea from ever + * scrolling * * @method scroll_if_long - * @param [lines=20,configurable]{Number} + * @param [lines=OutputArea.scroll_threshold]{Number} Default to `OutputArea.scroll_threshold` * **/ OutputArea.prototype.scroll_if_long = function (lines) { From 0c2dd44f8d3aa729bb08124914279a4ef5f2ef56 Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Tue, 28 May 2013 21:51:46 +0200 Subject: [PATCH 3/5] rename scroll_threshold, add minimum_ prefix --- .../html/notebook/static/notebook/js/outputarea.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/IPython/frontend/html/notebook/static/notebook/js/outputarea.js b/IPython/frontend/html/notebook/static/notebook/js/outputarea.js index d3bb0c67f..7bf9fac1b 100644 --- a/IPython/frontend/html/notebook/static/notebook/js/outputarea.js +++ b/IPython/frontend/html/notebook/static/notebook/js/outputarea.js @@ -168,7 +168,7 @@ var IPython = (function (IPython) { * Threshold to trigger autoscroll when the OutputArea is resized, * typically when new outputs are added. * - * Behavior is undefined if autoscroll is lower than scroll_threshold, + * Behavior is undefined if autoscroll is lower than minimum_scroll_threshold, * unless it is < 0, in which case autoscroll will never be triggered * * @property auto_scroll_threshold @@ -183,12 +183,12 @@ var IPython = (function (IPython) { * Lower limit (in lines) for OutputArea to be made scrollable. OutputAreas * shorter than this are never scrolled. * - * @property scroll_threshold + * @property minimum_scroll_threshold * @type Number * @default 20 * **/ - OutputArea.scroll_threshold = 20; + OutputArea.minimum_scroll_threshold = 20; /** @@ -196,17 +196,17 @@ var IPython = (function (IPython) { * Scroll OutputArea if height supperior than a threshold (in lines). * * Threshold is a maximum number of lines. If unspecified, defaults to - * OutputArea.scroll_threshold. + * OutputArea.minimum_scroll_threshold. * * Negative or null (0) threshold will prevent the OutputArea from ever * scrolling * * @method scroll_if_long - * @param [lines=OutputArea.scroll_threshold]{Number} Default to `OutputArea.scroll_threshold` + * @param [lines=OutputArea.minimum_scroll_threshold]{Number} Default to `OutputArea.minimum_scroll_threshold` * **/ OutputArea.prototype.scroll_if_long = function (lines) { - var n = lines | OutputArea.scroll_threshold; + var n = lines | OutputArea.minimum_scroll_threshold; if(n <= 0){ return } From 0c6c87b446191ce75a77298c37a08df636a63538 Mon Sep 17 00:00:00 2001 From: Matthias BUSSONNIER Date: Wed, 29 May 2013 11:19:19 +0200 Subject: [PATCH 4/5] document undefined behavior for 0 parameter --- .../html/notebook/static/notebook/js/outputarea.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/IPython/frontend/html/notebook/static/notebook/js/outputarea.js b/IPython/frontend/html/notebook/static/notebook/js/outputarea.js index 7bf9fac1b..692e0c637 100644 --- a/IPython/frontend/html/notebook/static/notebook/js/outputarea.js +++ b/IPython/frontend/html/notebook/static/notebook/js/outputarea.js @@ -198,11 +198,12 @@ var IPython = (function (IPython) { * Threshold is a maximum number of lines. If unspecified, defaults to * OutputArea.minimum_scroll_threshold. * - * Negative or null (0) threshold will prevent the OutputArea from ever - * scrolling + * Negative threshold will prevent the OutputArea from ever scrolling. * * @method scroll_if_long - * @param [lines=OutputArea.minimum_scroll_threshold]{Number} Default to `OutputArea.minimum_scroll_threshold` + * + * @param [lines=20]{Number} Default to 20 if not set, + * behavior undefined for value of `0`. * **/ OutputArea.prototype.scroll_if_long = function (lines) { From 17e4486de212e1069fb87cb71b764243d462f824 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Thu, 30 May 2013 09:08:01 +0300 Subject: [PATCH 5/5] set autoscroll default back to 100 --- .../frontend/html/notebook/static/notebook/js/outputarea.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IPython/frontend/html/notebook/static/notebook/js/outputarea.js b/IPython/frontend/html/notebook/static/notebook/js/outputarea.js index 692e0c637..dfbf5819b 100644 --- a/IPython/frontend/html/notebook/static/notebook/js/outputarea.js +++ b/IPython/frontend/html/notebook/static/notebook/js/outputarea.js @@ -173,10 +173,10 @@ var IPython = (function (IPython) { * * @property auto_scroll_threshold * @type Number - * @default 20 + * @default 100 * **/ - OutputArea.auto_scroll_threshold = 20; + OutputArea.auto_scroll_threshold = 100; /**