Skip to content

Commit

Permalink
[show-hint addon] Fix scrollbar on hint widget overlapping text
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed May 25, 2016
1 parent 320b301 commit 352e34c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 0 additions & 1 deletion addon/hint/show-hint.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
padding: 0 4px;
border-radius: 2px;
max-width: 19em;
overflow: hidden;
white-space: pre;
color: black;
cursor: pointer;
Expand Down
2 changes: 2 additions & 0 deletions addon/hint/show-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@
var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);
(completion.options.container || document.body).appendChild(hints);
var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH;
var scrolls = hints.scrollHeight > hints.clientHeight + 1
if (overlapY > 0) {
var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top);
if (curTop - height > 0) { // Fits above cursor
Expand All @@ -253,6 +254,7 @@
}
hints.style.left = (left = pos.left - overlapX) + "px";
}
if (scrolls) hints.style.paddingRight = cm.display.nativeBarWidth + "px"

cm.addKeyMap(this.keyMap = buildKeyMap(completion, {
moveFocus: function(n, avoidWrap) { widget.changeActive(widget.selectedHint + n, avoidWrap); },
Expand Down

0 comments on commit 352e34c

Please sign in to comment.