dalance / termbg

A Rust library for terminal background color detection
Apache License 2.0
87 stars 8 forks source link

Bytes leak when `]11` OSC is used to get background color. #4

Closed kunalmohan closed 3 years ago

kunalmohan commented 3 years ago

When "\x1b]11;?\x1b\\" is used to query the background color, the loop reading stdin breaks after receiving the 0x1b byte. But there is still one byte left in stdin to be read (In my case 0x5c) which causes problems if I try to read stdin after this. I'm not sure if this also happens in the other two cases as well. https://github.com/dalance/termbg/blob/6a1bdcb86cf103648bcad4f0b6c8c3dc48d057b3/src/lib.rs#L175-L181

I'm running bash in alacritty.

dalance commented 3 years ago

Thanks! I fixed it, and released v0.2.2.

kunalmohan commented 3 years ago

Wow! That was quick. Thanks!