diff --git a/demo/kitchen-sink/demo.js b/demo/kitchen-sink/demo.js
index abd5deb8..88d5fa0e 100644
--- a/demo/kitchen-sink/demo.js
+++ b/demo/kitchen-sink/demo.js
@@ -430,6 +430,9 @@ bindCheckbox("fade_fold_widgets", function(checked) {
bindCheckbox("read_only", function(checked) {
env.editor.setReadOnly(checked);
});
+bindCheckbox("scrollPastEnd", function(checked) {
+ env.editor.setOption("scrollPastEnd", checked);
+});
bindDropdown("split", function(value) {
var sp = env.split;
diff --git a/kitchen-sink.html b/kitchen-sink.html
index bb534835..586b317e 100644
--- a/kitchen-sink.html
+++ b/kitchen-sink.html
@@ -274,6 +274,14 @@
+
+ |
+
+ |
+
+
+ |
+
|
diff --git a/lib/ace/editor.js b/lib/ace/editor.js
index 088fbaae..d92666b8 100644
--- a/lib/ace/editor.js
+++ b/lib/ace/editor.js
@@ -2261,6 +2261,7 @@ config.defineOptions(Editor.prototype, "editor", {
fontFamily: "renderer",
maxLines: "renderer",
minLines: "renderer",
+ scrollPastEnd: "renderer",
scrollSpeed: "$mouseHandler",
dragDelay: "$mouseHandler",
diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js
index 6ed5a01d..3e9a535d 100644
--- a/lib/ace/virtual_renderer.js
+++ b/lib/ace/virtual_renderer.js
@@ -848,7 +848,7 @@ var VirtualRenderer = function(container, theme) {
var hideScrollbars = this.$size.height <= 2 * this.lineHeight;
var screenLines = this.session.getScreenLength()
- var maxHeight = screenLines * this.lineHeight;
+ var maxHeight = screenLines * this.lineHeight;
var offset = this.scrollTop % this.lineHeight;
var minHeight = this.$size.scrollerHeight + this.lineHeight;
@@ -864,6 +864,14 @@ var VirtualRenderer = function(container, theme) {
this.scrollBarH.setVisible(horizScroll);
}
+ if (!this.$maxLines && this.$scrollPastEnd) {
+ if (this.scrollTop > maxHeight - this.$size.scrollerHeight)
+ maxHeight += Math.min(
+ (this.$size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd,
+ this.scrollTop - maxHeight + this.$size.scrollerHeight
+ );
+ }
+
var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible ||
this.$size.scrollerHeight - maxHeight < 0);
var vScrollChanged = this.$vScroll !== vScroll;
@@ -1268,7 +1276,8 @@ var VirtualRenderer = function(container, theme) {
if (deltaY < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top)
return true;
if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight
- - this.layerConfig.maxHeight < -1 + this.scrollMargin.bottom)
+ - this.layerConfig.maxHeight - (this.$size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd
+ < -1 + this.scrollMargin.bottom)
return true;
// todo: better handle horizontal scrolling
if (deltaX)
@@ -1579,9 +1588,23 @@ config.defineOptions(VirtualRenderer.prototype, "renderer", {
}
},
minLines: {
- set: function(name) {
+ set: function(val) {
this.updateFull();
}
+ },
+ scrollPastEnd: {
+ set: function(val) {
+ if (val == true)
+ val = 1;
+ else if (val == false)
+ val = 0;
+ if (this.$scrollPastEnd == val)
+ return;
+ this.$scrollPastEnd = val;
+ this.$loop.schedule(this.CHANGE_SCROLL);
+ },
+ initialValue: 1,
+ handlesSet: true
}
});
|