From 8a0f58c63d70fc42d155f7ff6e9a429accf46e34 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 1 Aug 2017 14:28:10 +0100 Subject: [PATCH] Use correct character width --- .../auto-complete/AutoCompleteManager.coffee | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee index 348fe32f6b..751e534a32 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee @@ -288,10 +288,14 @@ define [ if filtered = editor?.completer?.completions?.filtered longestCaption = _.max(filtered.map( (c) -> c.caption.length )) longestMeta = _.max(filtered.map( (c) -> c.meta.length )) - charScale = @$scope.fontSize * 0.7 - width = Math.min( - Math.round(longestCaption*charScale + longestMeta*charScale + 25), - 700 + charWidth = editor.renderer.characterWidth + # between 280 and 700 px + width = Math.max( + Math.min( + Math.round(longestCaption*charWidth + longestMeta*charWidth + 5*charWidth), + 700 + ), + 280 ) container.css({width: "#{width}px"}) if editor.completer?.completions?.filtered?.length == 0