Skip to content

Add terminal_size_pixels() to expose terminal's pixel size

rabite0 requested to merge rabite0/termion:master into master

This adds a new function called terminal_size_pixels(), which works like terminal_size(), but returns the size in pixels instead.

EDIT: Had a small brain fart there after looking at it again. The only change from the initial merge request is the removal of a newline for stylistic reasons. Other than that you might want the new function (with different name then?) to return all size information instead and maybe have the regular terminal_size() use that, for slightly less duplicated code. Not sure if it's worth it in this case, though.

Just to elaborate a bit, this is important for drawing correctly sized/positioned SIXEL (and I guess other) graphics. Without knowing the terminal size in pixels it's hard to do it correctly.

Edited by rabite0

Merge request reports