Skip to content
Myr

feat: add a cmd to request window size (#988)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* feat: add a cmd to request window size Fixes: https://github.com/charmbracelet/bubbletea/issues/987#issuecomment-2068452658 * Update commands.go Co-authored-by: Christian Rocha <christian@rocha.is> ---------

authored by Ayman Bagabas · committed by GitHub · parent 4497aa9 · Browse files · 2 files+16 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Christian Rocha <christian@rocha.is>

Diff stats

2 files+16 added−0 removed

  • other:+16 added−0 removed

2 files+16 added−0 removed

modified:commands.go+13 added
199 unmodified lines
200 return func() Msg {201 return setWindowTitleMsg(title)202 }203}204205type windowSizeMsg struct{}206207// WindowSize is a command that queries the terminal for its current size. It208// delivers the results to Update via a [WindowSizeMsg]. Keep in mind that209// WindowSizeMsgs will automatically be delivered to Update when the [Program]210// starts and when the window dimensions change so in many cases you will not211// need to explicitly invoke this command.212func WindowSize() Cmd {213 return func() Msg {214 return windowSizeMsg{}215 }216}
modified:tea.go+3 added
420 unmodified lines
421 }()422423 case setWindowTitleMsg:424 p.SetWindowTitle(string(msg))425426 case windowSizeMsg:427 p.checkResize()428 }429430 // Process internal messages for the renderer.431 if r, ok := p.renderer.(*standardRenderer); ok {
319 unmodified lines