mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-22 02:04:31 +00:00
Use correct character width
This commit is contained in:
parent
3ffef7fe56
commit
8a0f58c63d
1 changed files with 8 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue