Skip to content

Commit 4d8a31f

Browse files
committed
fix popup position flipping
1 parent eecbe48 commit 4d8a31f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

lib/ace/autocomplete/popup.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,12 @@ var AcePopup = function(parentNode) {
206206
};
207207
popup.show = function(pos, lineHeight) {
208208
var el = this.container;
209-
if (pos.top > window.innerHeight / 2 + lineHeight) {
209+
var screenHeight = window.innerHeight;
210+
var renderer = this.renderer;
211+
var maxH = renderer.$maxLines * lineHeight;
212+
if (pos.top +maxH > screenHeight - lineHeight) {
210213
el.style.top = "";
211-
el.style.bottom = window.innerHeight - pos.top + "px";
214+
el.style.bottom = screenHeight - pos.top + "px";
212215
} else {
213216
pos.top += lineHeight;
214217
el.style.top = pos.top + "px";

0 commit comments

Comments
 (0)