Skip to content

Commit

Permalink
fix vertical auto completion position
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed Apr 11, 2018
1 parent 687e1f7 commit dd2986b
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ export default function onHasCompletion(cm, data, onHintInformationRender) {
wrapper.appendChild(deprecation)
}

const wrapperHeight = wrapper.clientHeight
const currentTop = parseFloat(String(top).replace('px', ''))
let newTop = currentTop
if (wrapperHeight + currentTop > window.innerHeight) {
newTop = window.innerHeight - 40 - wrapperHeight
}

wrapper.style.top = `${newTop}px`
;(global as any).wrapper = wrapper

// When CodeMirror attempts to remove the hint UI, we detect that it was
// removed from our wrapper and in turn remove the wrapper from the
// original container.
Expand Down

0 comments on commit dd2986b

Please sign in to comment.