def calc_width(view):
'''
return float width, which must be
0.0 < width < 1.0 (other values acceptable, but cause unfriendly layout)
used in show.show() and "outline_select" command with other_group=True
'''
width = view.settings().get('outline_width', 0.3)
if isinstance(width, float):
width -= width//1 # must be less than 1
elif isinstance(width, int if ST3 else long): # assume it is pixels
wport = view.viewport_extent()[0]
width = 1 - round((wport - width) / wport, 2)
if width >= 1:
width = 0.9
else:
sublime.error_message(u'FileBrowser:\n\noutline_width set to '
u'unacceptable type "%s", please change it.\n\n'
u'Fallback to default 0.3 for now.' % type(width))
width = 0.3
return width or 0.1 # avoid 0.0
评论列表
文章目录