Skip to content

Commit

Permalink
chore: revert "chore: deprecate some StartupOptions in favor of Cmds (#…
Browse files Browse the repository at this point in the history
…1307)"

This reverts commit 75d1b4b.
  • Loading branch information
aymanbagabas committed Feb 11, 2025
1 parent ee7cf45 commit cb6f840
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 40 deletions.
17 changes: 0 additions & 17 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,13 @@ func WithoutSignals() ProgramOption {
//
// To enter the altscreen once the program has already started running use the
// EnterAltScreen command.
//
// Deprecated: use the [EnterAltScreen] [Cmd] in your [Model.Init] instead.
func WithAltScreen() ProgramOption {
return func(p *Program) {
p.startupOptions |= withAltScreen
}
}

// WithoutBracketedPaste starts the program with bracketed paste disabled.
//
// Deprecated: use the [EnableBracketedPaste] [Cmd] in your [Model.Init]
// instead.
func WithoutBracketedPaste() ProgramOption {
return func(p *Program) {
p.startupOptions |= withoutBracketedPaste
Expand All @@ -139,9 +134,6 @@ func WithoutBracketedPaste() ProgramOption {
// running use the DisableMouse command.
//
// The mouse will be automatically disabled when the program exits.
//
// Deprecated: use the [EnableMouseCellMotion] [Cmd] in your [Model.Init]
// instead.
func WithMouseCellMotion() ProgramOption {
return func(p *Program) {
p.startupOptions |= withMouseCellMotion // set
Expand All @@ -167,9 +159,6 @@ func WithMouseCellMotion() ProgramOption {
// running use the DisableMouse command.
//
// The mouse will be automatically disabled when the program exits.
//
// Deprecated: use the [EnableMouseAllMotion] [Cmd] in your [Model.Init]
// instead.
func WithMouseAllMotion() ProgramOption {
return func(p *Program) {
p.startupOptions |= withMouseAllMotion // set
Expand Down Expand Up @@ -199,10 +188,6 @@ func WithoutRenderer() ProgramOption {
//
// Deprecated: this incurs a noticeable performance hit. A future release will
// optimize ANSI automatically without the performance penalty.
//
// Deprecated: this will be removed in a future release. This ANSI compressor
// has major performance implications and we don't recommend using it. In v2,
// rendering bandwidth will be decreased significantly.
func WithANSICompressor() ProgramOption {
return func(p *Program) {
p.startupOptions |= withANSICompressor
Expand Down Expand Up @@ -260,8 +245,6 @@ func WithFPS(fps int) ProgramOption {
// Note that while most terminals and multiplexers support focus reporting,
// some do not. Also note that tmux needs to be configured to report focus
// events.
//
// Deprecated: use the [EnableReportFocus] [Cmd] in your [Model.Init] instead.
func WithReportFocus() ProgramOption {
return func(p *Program) {
p.startupOptions |= withReportFocus
Expand Down
37 changes: 14 additions & 23 deletions screen.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ func ClearScreen() Msg {
type clearScreenMsg struct{}

// EnterAltScreen is a special command that tells the Bubble Tea program to
// enter the alternate screen buffer (i.e. the full terminal window). The
// altscreen will be automatically exited when the program quits. To manually
// exit the altscreen while the program is running, use [ExitAltScreen].
// enter the alternate screen buffer.
//
// Because commands run asynchronously, this command should not be used in your
// model's Init function. To initialize your program with the altscreen enabled
Expand All @@ -51,17 +49,15 @@ func ExitAltScreen() Msg {
}

// exitAltScreenMsg in an internal message signals that the program should exit
// alternate screen buffer. You can send a exitAltScreenMsg with
// [ExitAltScreen].
// alternate screen buffer. You can send a exitAltScreenMsg with ExitAltScreen.
type exitAltScreenMsg struct{}

// EnableMouseCellMotion is a special command that enables mouse click,
// release, and wheel events. Mouse movement events are also captured if
// a mouse button is pressed (i.e., drag events).
//
// Because commands run asynchronously, this command should not be used in your
// model's Init function. Use the [WithMouseCellMotion] [ProgramOption]
// instead.
// model's Init function. Use the WithMouseCellMotion ProgramOption instead.
func EnableMouseCellMotion() Msg {
return enableMouseCellMotionMsg{}
}
Expand All @@ -76,7 +72,7 @@ type enableMouseCellMotionMsg struct{}
// button is pressed, effectively enabling support for hover interactions.
//
// Many modern terminals support this, but not all. If in doubt, use
// [EnableMouseCellMotion] instead.
// EnableMouseCellMotion instead.
//
// Because commands run asynchronously, this command should not be used in your
// model's Init function. Use the WithMouseAllMotion ProgramOption instead.
Expand Down Expand Up @@ -112,9 +108,6 @@ type hideCursorMsg struct{}

// ShowCursor is a special command for manually instructing Bubble Tea to show
// the cursor.
//
// Deprecated: this will be removed in a future release. In v2, the cursor will
// can be manged via a dedicated API.
func ShowCursor() Msg {
return showCursorMsg{}
}
Expand All @@ -124,10 +117,9 @@ func ShowCursor() Msg {
type showCursorMsg struct{}

// EnableBracketedPaste is a special command that tells the Bubble Tea program
// to accept bracketed paste input. To disable bracketed paste, use
// [DisableBracketedPaste].
// to accept bracketed paste input.
//
// Also note that bracketed paste will be automatically disabled when the
// Note that bracketed paste will be automatically disabled when the
// program quits.
func EnableBracketedPaste() Msg {
return enableBracketedPasteMsg{}
Expand All @@ -139,18 +131,17 @@ func EnableBracketedPaste() Msg {
type enableBracketedPasteMsg struct{}

// DisableBracketedPaste is a special command that tells the Bubble Tea program
// to accept bracketed paste input. To enable bracketed paste, use
// [EnableBracketedPaste].
// to accept bracketed paste input.
//
// Also note that bracketed paste will be automatically disabled when the
// Note that bracketed paste will be automatically disabled when the
// program quits.
func DisableBracketedPaste() Msg {
return disableBracketedPasteMsg{}
}

// disableBracketedPasteMsg in an internal message signals that bracketed paste
// should be disabled. You can send an disableBracketedPasteMsg with
// DisableBracketedPaste.
// disableBracketedPasteMsg in an internal message signals that
// bracketed paste should be disabled. You can send an
// disableBracketedPasteMsg with DisableBracketedPaste.
type disableBracketedPasteMsg struct{}

// enableReportFocusMsg is an internal message that signals to enable focus
Expand All @@ -176,7 +167,7 @@ func DisableReportFocus() Msg {
// EnterAltScreen enters the alternate screen buffer, which consumes the entire
// terminal window. ExitAltScreen will return the terminal to its former state.
//
// Deprecated: Use the [EnterAltScreen] [Cmd] instead.
// Deprecated: Use the WithAltScreen ProgramOption instead.
func (p *Program) EnterAltScreen() {
if p.renderer != nil {
p.renderer.enterAltScreen()
Expand All @@ -199,7 +190,7 @@ func (p *Program) ExitAltScreen() {
// EnableMouseCellMotion enables mouse click, release, wheel and motion events
// if a mouse button is pressed (i.e., drag events).
//
// Deprecated: Use the [EnableMouseCellMotion] [Cmd] instead.
// Deprecated: Use the WithMouseCellMotion ProgramOption instead.
func (p *Program) EnableMouseCellMotion() {
if p.renderer != nil {
p.renderer.enableMouseCellMotion()
Expand All @@ -224,7 +215,7 @@ func (p *Program) DisableMouseCellMotion() {
// regardless of whether a mouse button is pressed. Many modern terminals
// support this, but not all.
//
// Deprecated: Use the [EnableMouseAllMotion] [Cmd] instead.
// Deprecated: Use the WithMouseAllMotion ProgramOption instead.
func (p *Program) EnableMouseAllMotion() {
if p.renderer != nil {
p.renderer.enableMouseAllMotion()
Expand Down

0 comments on commit cb6f840

Please sign in to comment.