Skip to content

Commit

Permalink
Revert "Restore old scrolling logic"
Browse files Browse the repository at this point in the history
Restoring old scrolling logic did not fix editor window scrolling bug.

This reverts commit 98c0a52.
  • Loading branch information
lennartcl committed Jun 1, 2012
1 parent 98c0a52 commit ff1e7cb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions plugins-client/ext.language/complete.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var drawCompletionBox;
var CLASS_SELECTED = "cc_complete_option selected";
var CLASS_UNSELECTED = "cc_complete_option";
var MENU_WIDTH = 300;
var MENU_SCROLL_AT = 4;
var MENU_SHOWN_ITEMS = 8;

var deferredInvoke = lang.deferredCall(function() {
var editor = editors.currentEditor.ceEditor.$editor;
Expand Down Expand Up @@ -161,7 +161,7 @@ module.exports = {
ace.container.addEventListener("mousewheel", this.closeCompletionBox);

apf.popup.setContent("completionBox", barCompleterCont.$ext);
var boxLength = this.matches.length || 1;
var boxLength = Math.max(MENU_SHOWN_ITEMS, this.matches.length || 1);
var completionBoxHeight = 11 + Math.min(10 * this.cursorConfig.lineHeight, boxLength * (this.cursorConfig.lineHeight));
var cursorLayer = ace.renderer.$cursorLayer;

Expand Down Expand Up @@ -338,7 +338,7 @@ module.exports = {
if(this.selectedIdx < this.matches.length-1)
this.selectedIdx++;
this.matchEls[this.selectedIdx].className = CLASS_SELECTED;
if(this.selectedIdx - this.scrollIdx > MENU_SCROLL_AT) {
if(this.selectedIdx - this.scrollIdx > MENU_SHOWN_ITEMS) {
this.scrollIdx++;
this.matchEls[this.scrollIdx].scrollIntoView(true);
}
Expand All @@ -355,8 +355,8 @@ module.exports = {
return;
}
this.matchEls[this.selectedIdx].className = CLASS_SELECTED;
if(this.selectedIdx < this.matches.length - MENU_SCROLL_AT && this.scrollIdx > 0) {
this.scrollIdx = this.selectedIdx - MENU_SCROLL_AT;
if(this.selectedIdx < this.scrollIdx) {
this.scrollIdx--;
this.matchEls[this.scrollIdx].scrollIntoView(true);
}
e.stopPropagation();
Expand Down

0 comments on commit ff1e7cb

Please sign in to comment.