charmbracelet / bubbletea

A powerful little TUI framework 🏗
MIT License
25.65k stars 744 forks source link

Prevent multiple window-size-events from firing on Windows #1021

Closed aymanbagabas closed 2 months ago

aymanbagabas commented 2 months ago

Windows alt-screen-buffer changes trigger window-size-events causing Bubble Tea to send a new event even if the window size is the same as before. This simply checks if the window size is the same before bubbling it to the model.

Fixes: https://github.com/charmbracelet/bubbletea/issues/1019

meowgorithm commented 2 months ago

@aymanbagabas will this still send WindowSizeMsgs when going in and out of the alt screen?

aymanbagabas commented 2 months ago

@aymanbagabas will this still send WindowSizeMsgs when going in and out of the alt screen?

This won't send more than one WindowSizeMsg with the same size, so yes it will still send the msg but only if the size changes.