According to the imgcat specifications, width and height can be specified with one of 4 types of values:
N: N character cells.
Npx: N pixels.
N%: N percent of the session's width or height.
auto: The image's inherent size will be used to determine an appropriate dimension.
In Terminus, N% seems to work, passing just N does scale the image, but it's not quite 1:1 to a character cell (or I may be misunderstanding this), and passing Npx crashes the plugin.
I should note I ran into this because Rails passes height=400px when displaying inline screenshots from the test runner. So it's something many people could encounter (and not have direct control over).
Sublime console backtrace:
Traceback (most recent call last):
File "./python3.3/threading.py", line 901, in _bootstrap_inner
File "./python3.3/threading.py", line 858, in run
File "/home/matthew/.config/sublime-text-3/Installed Packages/Terminus.sublime-package/terminus/terminal.py", line 156, in renderer
feed_data()
File "/home/matthew/.config/sublime-text-3/Installed Packages/Terminus.sublime-package/terminus/terminal.py", line 151, in feed_data
self.stream.feed(data[0])
File "/home/matthew/.config/sublime-text-3/Installed Packages/Terminus.sublime-package/terminus/ptty.py", line 784, in feed
send(data[start])
File "/home/matthew/.config/sublime-text-3/Installed Packages/Terminus.sublime-package/terminus/ptty.py", line 757, in _parser_fsm
osc_dispatch[code](param)
File "/home/matthew/.config/sublime-text-3/Installed Packages/Terminus.sublime-package/terminus/ptty.py", line 548, in handle_iterm_protocol
self.show_image_callback(data, arguments, cr)
File "/home/matthew/.config/sublime-text-3/Installed Packages/Terminus.sublime-package/terminus/terminal.py", line 403, in show_image
args["preserveAspectRatio"] if "preserveAspectRatio" in args else 1
File "/home/matthew/.config/sublime-text-3/Installed Packages/Terminus.sublime-package/terminus/image.py", line 71, in image_resize
height = int((area / ratio) ** 0.5)
TypeError: unsupported operand type(s) for /: 'str' and 'float'
According to the imgcat specifications, width and height can be specified with one of 4 types of values:
In Terminus,
N%
seems to work, passing justN
does scale the image, but it's not quite 1:1 to a character cell (or I may be misunderstanding this), and passingNpx
crashes the plugin.I should note I ran into this because Rails passes height=400px when displaying inline screenshots from the test runner. So it's something many people could encounter (and not have direct control over).
Sublime console backtrace: