mattn / go-tty

MIT License
208 stars 18 forks source link

feature request: terminal size in pixels #18

Closed srlehn closed 5 years ago

srlehn commented 5 years ago

Hi. I was wondering if it is possible to implement a function to query the terminal size in pixels. This is needed to calculate the size of a character cell in pixels which is required to size sixel images correctly depending on the terminal.

I did this with the "\033[14t" escape code. But xterm for example doesn't respond. conhost.exe probably too.

Is there some other way?

I would like to replace this in my function in gizak/termui#233

srlehn commented 5 years ago

I think TIOCGWINSZ should do this.

When I read http://www.delorie.com/djgpp/doc/libc/libc_495.html correctly dim[2] and dim[3] in (*TTY)size(int,int,error) should already have the values.

srlehn commented 5 years ago

I made the PR #21 to showcase what i have in mind.

It would be great if you could give go-tty this functionality.

srlehn commented 5 years ago

Thanks for the merge!