termux-app icon indicating copy to clipboard operation
termux-app copied to clipboard

[Feature]: a app can't determine the size of the textcell because termux needs to implement TIOCGWINSZ with ws_xpixel and ws_ypixel set. Without that, a app does not have enough information to show animations or videos.

Open rihaq opened this issue 2 years ago • 1 comments

Feature description

A app can't determine the size of the textcell because termux needs to implement TIOCGWINSZ with ws_xpixel and ws_ypixel set. Without that, a app does not have enough information to show animations or videos.

Additional information

https://github.com/hzeller/timg/issues/91#issuecomment-1312804171

rihaq avatar Nov 14 '22 11:11 rihaq

More context: the TIOCGWINSZ ioctl fills the following struct

struct winsize {
    unsigned short ws_row;    /* number of text rows in the terminal */
    unsigned short ws_col;     /* number of text columns in the terminal */
    unsigned short ws_xpixel;  /* pixel width of the terminal occupied by characters */
    unsigned short ws_ypixel;  /* pixel height of the terminal occupied by characters */
};

So say we have 30 rows and 60 columns. The font is 10x15 pixel. Then ws_xpixel = 10 * 60 and ws_ypixel = 60 * 15.

ws_row and ws_col are common but ws_xpixel, ws_ypixel is sometimes still omitted as it is a newer addition. However it is absolutely essential for applications that want to make use of the pixel-accurate output of animations using the iterm2 protocol, as the jump-back cursor movements are done in character cell units. Tools such as timg need this information determine the exact pixel size of a character cell.

I suppose with that context, it should be easy to implement in termux.

hzeller avatar Nov 14 '22 16:11 hzeller