fix: use .New() instead of the deprecated .NewModel() to init models

This commit is contained in:
2022-01-15 22:50:38 +02:00
parent e44f31f30a
commit f097431b8f
3 changed files with 6 additions and 8 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ func NewLogin() State {
var t textinput.Model var t textinput.Model
for i := range ls.Inputs { for i := range ls.Inputs {
t = textinput.NewModel() t = textinput.New()
t.CursorStyle = ui.CursorStyle t.CursorStyle = ui.CursorStyle
t.Prompt = "| " t.Prompt = "| "
+1 -1
View File
@@ -30,7 +30,7 @@ type InputState struct {
} }
func NewInputBox() InputState { func NewInputBox() InputState {
input := textinput.NewModel() input := textinput.New()
input.Placeholder = "Send a message..." input.Placeholder = "Send a message..."
input.Focus() input.Focus()
+4 -6
View File
@@ -51,16 +51,14 @@ type State struct {
} }
func NewMainScreen(client *client.Client) State { func NewMainScreen(client *client.Client) State {
newViewport := &viewport.Model{ newViewport := viewport.New(0, 0)
HighPerformanceRendering: false, newViewport.Wrap = viewport.Wrap
Wrap: viewport.Wrap, newViewport.Style = MessagesStyle.Copy()
Style: MessagesStyle.Copy(),
}
return State{ return State{
ConnReader: nil, ConnReader: nil,
Client: client, Client: client,
Viewport: newViewport, Viewport: &newViewport,
FocusIndex: InputBox, FocusIndex: InputBox,
InputBox: NewInputBox(), InputBox: NewInputBox(),
SidePanel: NewSidePanel(client), SidePanel: NewSidePanel(client),