Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #3232 from TomMalbran/tom/fix-issue-3228
Browse files Browse the repository at this point in the history
Fix #3228: Codehints selection popup is positioned wrong when the font size is not standard
  • Loading branch information
jbalsas committed Mar 29, 2013
2 parents ebab357 + 3300ec8 commit ad246f3
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/editor/CodeHintList.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,21 +208,22 @@ define(function (require, exports, module) {
* @return {{left: number, top: number}}
*/
CodeHintList.prototype._calcHintListLocation = function () {
var cursor = this.editor._codeMirror.cursorCoords(),
posTop = cursor.top,
posLeft = cursor.left,
$window = $(window),
$menuWindow = this.$hintMenu.children("ul");
var cursor = this.editor._codeMirror.cursorCoords(),
posTop = cursor.bottom,
posLeft = cursor.left,
textHeight = this.editor.getTextHeight(),
$window = $(window),
$menuWindow = this.$hintMenu.children("ul"),
menuHeight = $menuWindow.outerHeight();

// TODO Ty: factor out menu repositioning logic so code hints and Context menus share code
// adjust positioning so menu is not clipped off bottom or right
var bottomOverhang = posTop + 25 + $menuWindow.height() - $window.height();
var bottomOverhang = posTop + menuHeight - $window.height();
if (bottomOverhang > 0) {
posTop -= (27 + $menuWindow.height());
posTop -= (textHeight + 2 + menuHeight);
}
// todo: should be shifted by line height
posTop -= 15; // shift top for hidden parent element
//posLeft += 5;

posTop -= 30; // shift top for hidden parent element

var rightOverhang = posLeft + $menuWindow.width() - $window.width();
if (rightOverhang > 0) {
Expand Down

0 comments on commit ad246f3

Please sign in to comment.