diff --git a/lib/ace/autocomplete/popup.js b/lib/ace/autocomplete/popup.js index e1ec86c2..4cf29073 100644 --- a/lib/ace/autocomplete/popup.js +++ b/lib/ace/autocomplete/popup.js @@ -206,9 +206,12 @@ var AcePopup = function(parentNode) { }; popup.show = function(pos, lineHeight) { var el = this.container; - if (pos.top > window.innerHeight / 2 + lineHeight) { + var screenHeight = window.innerHeight; + var renderer = this.renderer; + var maxH = renderer.$maxLines * lineHeight; + if (pos.top +maxH > screenHeight - lineHeight) { el.style.top = ""; - el.style.bottom = window.innerHeight - pos.top + "px"; + el.style.bottom = screenHeight - pos.top + "px"; } else { pos.top += lineHeight; el.style.top = pos.top + "px";