gizak / termui

Golang terminal dashboard
MIT License
13.16k stars 787 forks source link

flicker on callng ui.TermWidth() function #236

Open y9c opened 5 years ago

y9c commented 5 years ago

I need to make the ui autoadjustable. I use ui.TermWidth() to detect terminal width every second and resize it if terminal width is changed.

cjbassi commented 5 years ago

Just a quick tip but you can detect when the terminal is resized by listening for the "<Resized>" event from the channel returned from PollEvents(). Example here: https://github.com/gizak/termui/blob/213738dbc71cff7412f8dae6d9f27ce4c379dc38/_examples/grid.go#L95-L108