rossy / img2xterm

Displays images on your 256-color terminal with Unicode block characters.
http://img2xterm.sooaweso.me
Creative Commons Zero v1.0 Universal
174 stars 14 forks source link

Make color escape sequences conform to terminfo entry #5

Closed keithw closed 10 years ago

keithw commented 10 years ago

img2xterm had been combining multiple 256color rendition changes in the same SGR sequence, e.g., ESC [ 48;5;179; 38;5;100 m to change both the background and foreground color.

The xterm-256color terminfo entry requires (and mosh enforces) that these be in separate escapes. This commit makes the img2xterm output render correctly in mosh.

Example: echo -e "setab 179\nsetaf 100" | tput -S | od -c generates ESC [ 48;5;179 m ESC [ 38;5;100 m.

rossy commented 10 years ago

Looks good. Merging those sequences definitely isn't worth it if it causes incompatibility with mosh. Thanks for the patch.