Merge pull request #1507 from ajaxorg/scroll_past_end
[WIP] scrollPastEnd
This commit is contained in:
commit
a25a685d11
4 changed files with 38 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -274,6 +274,14 @@
|
|||
<input type="checkbox" id="read_only">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td >
|
||||
<label for="scrollPastEnd">Scroll Past End</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" id="scrollPastEnd" checked>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="button" value="Edit Snippets" onclick="env.editSnippets()">
|
||||
|
|
|
|||
|
|
@ -2261,6 +2261,7 @@ config.defineOptions(Editor.prototype, "editor", {
|
|||
fontFamily: "renderer",
|
||||
maxLines: "renderer",
|
||||
minLines: "renderer",
|
||||
scrollPastEnd: "renderer",
|
||||
|
||||
scrollSpeed: "$mouseHandler",
|
||||
dragDelay: "$mouseHandler",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue