Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(v2) refactor!: remove deprecated references #620

Open
wants to merge 1 commit into
base: v2-remove-deprecated
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions help/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@ func New() Model {
}
}

// NewModel creates a new help view with some useful defaults.
//
// Deprecated: use [New] instead.
var NewModel = New

// Update helps satisfy the Bubble Tea Model interface. It's a no-op.
func (m Model) Update(_ tea.Msg) (Model, tea.Cmd) {
return m, nil
Expand Down
5 changes: 0 additions & 5 deletions list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,6 @@
return m
}

// NewModel returns a new model with sensible defaults.
//
// Deprecated: use [New] instead.
var NewModel = New

// SetFilteringEnabled enables or disables filtering. Note that this is different
// from ShowFilter, which merely hides or shows the input view.
func (m *Model) SetFilteringEnabled(v bool) {
Expand All @@ -272,7 +267,7 @@

// SetFilterText explicitly sets the filter text without relying on user input.
// It also sets the filterState to a sane default of FilterApplied, but this
// can be changed with SetFilterState

Check failure on line 270 in list/list.go

View workflow job for this annotation

GitHub Actions / lint-soft

Comment should end in a period (godot)
func (m *Model) SetFilterText(filter string) {
m.filterState = Filtering
m.FilterInput.SetValue(filter)
Expand All @@ -288,7 +283,7 @@
m.updateKeybindings()
}

// Helper method for setting the filtering state manually

Check failure on line 286 in list/list.go

View workflow job for this annotation

GitHub Actions / lint-soft

Comment should end in a period (godot)
func (m *Model) SetFilterState(state FilterState) {
m.Paginator.Page = 0
m.cursor = 0
Expand Down Expand Up @@ -707,7 +702,7 @@

// Set keybindings according to the filter state.
func (m *Model) updateKeybindings() {
switch m.filterState {

Check failure on line 705 in list/list.go

View workflow job for this annotation

GitHub Actions / lint-soft

missing cases in switch of type list.FilterState: list.Unfiltered, list.FilterApplied (exhaustive)
case Filtering:
m.KeyMap.CursorUp.SetEnabled(false)
m.KeyMap.CursorDown.SetEnabled(false)
Expand Down Expand Up @@ -1138,7 +1133,7 @@

itemsDisplay := fmt.Sprintf("%d %s", visibleItems, itemName)

if m.filterState == Filtering {

Check failure on line 1136 in list/list.go

View workflow job for this annotation

GitHub Actions / lint-soft

`if m.filterState == Filtering` has complex nested blocks (complexity: 5) (nestif)
// Filter results
if visibleItems == 0 {
status = m.Styles.StatusEmpty.Render("Nothing matched")
Expand Down
16 changes: 0 additions & 16 deletions paginator/paginator.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,6 @@

// KeyMap encodes the keybindings recognized by the widget.
KeyMap KeyMap

// Deprecated: customize [KeyMap] instead.
UsePgUpPgDownKeys bool
// Deprecated: customize [KeyMap] instead.
UseLeftRightKeys bool
// Deprecated: customize [KeyMap] instead.
UseUpDownKeys bool
// Deprecated: customize [KeyMap] instead.
UseHLKeys bool
// Deprecated: customize [KeyMap] instead.
UseJKKeys bool
}

// SetTotalPages is a helper function for calculating the total number of pages
Expand Down Expand Up @@ -153,11 +142,6 @@
return m
}

// NewModel creates a new model with defaults.
//
// Deprecated: use [New] instead.
var NewModel = New

// WithTotalPages sets the total pages.
func WithTotalPages(totalPages int) Option {
return func(m *Model) {
Expand Down Expand Up @@ -189,7 +173,7 @@

// View renders the pagination to a string.
func (m Model) View() string {
switch m.Type {

Check failure on line 176 in paginator/paginator.go

View workflow job for this annotation

GitHub Actions / lint-soft

missing cases in switch of type paginator.Type: paginator.Arabic (exhaustive)
case Dots:
return m.dotsView()
default:
Expand Down
5 changes: 0 additions & 5 deletions progress/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,6 @@ func New(opts ...Option) Model {
return m
}

// NewModel returns a model with default values.
//
// Deprecated: use [New] instead.
var NewModel = New

// Init exists to satisfy the tea.Model interface.
func (m Model) Init() (tea.Model, tea.Cmd) {
return m, nil
Expand Down
13 changes: 0 additions & 13 deletions spinner/spinner.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@ func New(opts ...Option) Model {
return m
}

// NewModel returns a model with default values.
//
// Deprecated: use [New] instead.
var NewModel = New

// TickMsg indicates that the timer has ticked and we should render a frame.
type TickMsg struct {
Time time.Time
Expand Down Expand Up @@ -202,14 +197,6 @@ func (m Model) tick(id, tag int) tea.Cmd {
})
}

// Tick is the command used to advance the spinner one frame. Use this command
// to effectively start the spinner.
//
// Deprecated: Use [Model.Tick] instead.
func Tick() tea.Msg {
return TickMsg{Time: time.Now()}
}

// Option is used to set options in New. For example:
//
// spinner := New(WithSpinner(Dot))
Expand Down
40 changes: 0 additions & 40 deletions textinput/textinput.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import (
"reflect"
"strings"
"time"
"unicode"

"github.com/atotto/clipboard"
Expand Down Expand Up @@ -93,9 +92,6 @@
EchoCharacter rune
Cursor cursor.Model

// Deprecated: use [cursor.BlinkSpeed] instead.
BlinkSpeed time.Duration

// Styles. These will be applied as inline styles.
//
// For an introduction to styling with Lip Gloss see:
Expand All @@ -105,9 +101,6 @@
PlaceholderStyle lipgloss.Style
CompletionStyle lipgloss.Style

// Deprecated: use Cursor.Style instead.
CursorStyle lipgloss.Style

// CharLimit is the maximum amount of characters this input element will
// accept. If 0 or less, there's no limit.
CharLimit int
Expand Down Expand Up @@ -173,11 +166,6 @@
}
}

// NewModel creates a new model with default settings.
//
// Deprecated: Use [New] instead.
var NewModel = New

// SetValue sets the value of the text input.
func (m *Model) SetValue(s string) {
// Clean up any special characters in the input provided by the
Expand Down Expand Up @@ -661,7 +649,7 @@
pos := max(0, m.pos-m.offset)
v := styleText(m.echoTransform(string(value[:pos])))

if pos < len(value) {

Check failure on line 652 in textinput/textinput.go

View workflow job for this annotation

GitHub Actions / lint-soft

`if pos < len(value)` has complex nested blocks (complexity: 6) (nestif)
char := m.echoTransform(string(value[pos]))
m.Cursor.SetChar(char)
v += m.Cursor.View() // cursor and text under it
Expand Down Expand Up @@ -773,34 +761,6 @@
return b
}

// Deprecated.

// Deprecated: use cursor.Mode.
type CursorMode int

const (
// Deprecated: use cursor.CursorBlink.
CursorBlink = CursorMode(cursor.CursorBlink)
// Deprecated: use cursor.CursorStatic.
CursorStatic = CursorMode(cursor.CursorStatic)
// Deprecated: use cursor.CursorHide.
CursorHide = CursorMode(cursor.CursorHide)
)

func (c CursorMode) String() string {
return cursor.Mode(c).String()
}

// Deprecated: use cursor.Mode().
func (m Model) CursorMode() CursorMode {
return CursorMode(m.Cursor.Mode())
}

// Deprecated: use cursor.SetMode().
func (m *Model) SetCursorMode(mode CursorMode) tea.Cmd {
return m.Cursor.SetMode(cursor.Mode(mode))
}

func (m Model) completionView(offset int) string {
var (
value = m.value
Expand Down
Loading