chore: deprecate some StartupOptions in favor of Cmds (#1307)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Christian Rocha · committed by GitHub · parent 7f68efb · Browse files · 2 files·+40 added−14 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+40 added−14 removed
- other:+40 added−14 removed
Provenance
- Commit
75d1b4b- Tree
7ad0713- Author
Christian Rocha <christian@rocha.is>- Committer
GitHub <noreply@github.com>- Parent
7f68efb
2 files changed+40 added−14 removed
modified:options.go+17 added
104 unmodified lines105 // }106 //107 // To enter the altscreen once the program has already started running use the108 // EnterAltScreen command.109+//110+// Deprecated: use the [EnterAltScreen] [Cmd] in your [Model.Init] instead.111 func WithAltScreen() ProgramOption {112 return func(p *Program) {113 p.startupOptions |= withAltScreen114 }115 }116 117 // WithoutBracketedPaste starts the program with bracketed paste disabled.118+//119+// Deprecated: use the [EnableBracketedPaste] [Cmd] in your [Model.Init]120+// instead.121 func WithoutBracketedPaste() ProgramOption {122 return func(p *Program) {123 p.startupOptions |= withoutBracketedPaste124 }13 unmodified lines138 // the EnableMouseCellMotion command. To disable the mouse when the program is139 // running use the DisableMouse command.140 //141 // The mouse will be automatically disabled when the program exits.142+//143+// Deprecated: use the [EnableMouseCellMotion] [Cmd] in your [Model.Init]144+// instead.145 func WithMouseCellMotion() ProgramOption {146 return func(p *Program) {147 p.startupOptions |= withMouseCellMotion // set148 p.startupOptions &^= withMouseAllMotion // clear17 unmodified lines166 // EnableMouseAllMotion command. To disable the mouse when the program is167 // running use the DisableMouse command.168 //169 // The mouse will be automatically disabled when the program exits.170+//171+// Deprecated: use the [EnableMouseAllMotion] [Cmd] in your [Model.Init]172+// instead.173 func WithMouseAllMotion() ProgramOption {174 return func(p *Program) {175 p.startupOptions |= withMouseAllMotion // set176 p.startupOptions &^= withMouseCellMotion // clear21 unmodified lines198 // of this package.199 //200 // Deprecated: this incurs a noticeable performance hit. A future release will201 // optimize ANSI automatically without the performance penalty.202+//203+// Deprecated: this will be removed in a future release. This ANSI compressor204+// has major performance implications and we don't recommend using it. In v2,205+// rendering bandwidth will be decreased significantly.206 func WithANSICompressor() ProgramOption {207 return func(p *Program) {208 p.startupOptions |= withANSICompressor209 }49 unmodified lines259 //260 // Note that while most terminals and multiplexers support focus reporting,261 // some do not. Also note that tmux needs to be configured to report focus262 // events.263+//264+// Deprecated: use the [EnableReportFocus] [Cmd] in your [Model.Init] instead.265 func WithReportFocus() ProgramOption {266 return func(p *Program) {267 p.startupOptions |= withReportFocus268 }1 unmodified linemodified:screen.go+23 added-14 removed
22 unmodified lines23 // You can send a clearScreenMsg with ClearScreen.24 type clearScreenMsg struct{}25 26 // EnterAltScreen is a special command that tells the Bubble Tea program to27-// enter the alternate screen buffer.27+// enter the alternate screen buffer (i.e. the full terminal window). The28+// altscreen will be automatically exited when the program quits. To manually29+// exit the altscreen while the program is running, use [ExitAltScreen].30 //31 // Because commands run asynchronously, this command should not be used in your32 // model's Init function. To initialize your program with the altscreen enabled33 // use the WithAltScreen ProgramOption instead.16 unmodified lines50 return exitAltScreenMsg{}51 }52 53 // exitAltScreenMsg in an internal message signals that the program should exit52-// alternate screen buffer. You can send a exitAltScreenMsg with ExitAltScreen.54+// alternate screen buffer. You can send a exitAltScreenMsg with55+// [ExitAltScreen].56 type exitAltScreenMsg struct{}57 58 // EnableMouseCellMotion is a special command that enables mouse click,59 // release, and wheel events. Mouse movement events are also captured if60 // a mouse button is pressed (i.e., drag events).61 //62 // Because commands run asynchronously, this command should not be used in your60-// model's Init function. Use the WithMouseCellMotion ProgramOption instead.63+// model's Init function. Use the [WithMouseCellMotion] [ProgramOption]64+// instead.65 func EnableMouseCellMotion() Msg {66 return enableMouseCellMotionMsg{}67 }68 6 unmodified lines75 // wheel, and motion events, which are delivered regardless of whether a mouse76 // button is pressed, effectively enabling support for hover interactions.77 //78 // Many modern terminals support this, but not all. If in doubt, use75-// EnableMouseCellMotion instead.79+// [EnableMouseCellMotion] instead.80 //81 // Because commands run asynchronously, this command should not be used in your82 // model's Init function. Use the WithMouseAllMotion ProgramOption instead.83 func EnableMouseAllMotion() Msg {27 unmodified lines111 type hideCursorMsg struct{}112 113 // ShowCursor is a special command for manually instructing Bubble Tea to show114 // the cursor.115+//116+// Deprecated: this will be removed in a future release. In v2, the cursor will117+// can be manged via a dedicated API.118 func ShowCursor() Msg {119 return showCursorMsg{}120 }121 1 unmodified line123 // this message with ShowCursor.124 type showCursorMsg struct{}125 126 // EnableBracketedPaste is a special command that tells the Bubble Tea program120-// to accept bracketed paste input.127+// to accept bracketed paste input. To disable bracketed paste, use128+// [DisableBracketedPaste].129 //122-// Note that bracketed paste will be automatically disabled when the130+// Also note that bracketed paste will be automatically disabled when the131 // program quits.132 func EnableBracketedPaste() Msg {133 return enableBracketedPasteMsg{}134 }3 unmodified lines138 // enableBracketedPasteMsg with EnableBracketedPaste.139 type enableBracketedPasteMsg struct{}140 141 // DisableBracketedPaste is a special command that tells the Bubble Tea program134-// to accept bracketed paste input.142+// to accept bracketed paste input. To enable bracketed paste, use143+// [EnableBracketedPaste].144 //136-// Note that bracketed paste will be automatically disabled when the145+// Also note that bracketed paste will be automatically disabled when the146 // program quits.147 func DisableBracketedPaste() Msg {148 return disableBracketedPasteMsg{}149 }150 142-// disableBracketedPasteMsg in an internal message signals that143-// bracketed paste should be disabled. You can send an144-// disableBracketedPasteMsg with DisableBracketedPaste.151+// disableBracketedPasteMsg in an internal message signals that bracketed paste152+// should be disabled. You can send an disableBracketedPasteMsg with153+// DisableBracketedPaste.154 type disableBracketedPasteMsg struct{}155 156 // enableReportFocusMsg is an internal message that signals to enable focus157 // reporting. You can send an enableReportFocusMsg with EnableReportFocus.17 unmodified lines175 176 // EnterAltScreen enters the alternate screen buffer, which consumes the entire177 // terminal window. ExitAltScreen will return the terminal to its former state.178 //170-// Deprecated: Use the WithAltScreen ProgramOption instead.179+// Deprecated: Use the [EnterAltScreen] [Cmd] instead.180 func (p *Program) EnterAltScreen() {181 if p.renderer != nil {182 p.renderer.enterAltScreen()183 } else {14 unmodified lines198 199 // EnableMouseCellMotion enables mouse click, release, wheel and motion events200 // if a mouse button is pressed (i.e., drag events).201 //193-// Deprecated: Use the WithMouseCellMotion ProgramOption instead.202+// Deprecated: Use the [EnableMouseCellMotion] [Cmd] instead.203 func (p *Program) EnableMouseCellMotion() {204 if p.renderer != nil {205 p.renderer.enableMouseCellMotion()206 } else {16 unmodified lines223 // EnableMouseAllMotion enables mouse click, release, wheel and motion events,224 // regardless of whether a mouse button is pressed. Many modern terminals225 // support this, but not all.226 //218-// Deprecated: Use the WithMouseAllMotion ProgramOption instead.227+// Deprecated: Use the [EnableMouseAllMotion] [Cmd] instead.228 func (p *Program) EnableMouseAllMotion() {229 if p.renderer != nil {230 p.renderer.enableMouseAllMotion()231 } else {26 unmodified lines