mirror of
https://github.com/IllusionMan1212/gorc.git
synced 2026-10-24 02:12:33 +00:00
feat: BIG changes
* use commands constants * use a separate goroutine to read from connection * refactor connection reading and ui updating * add sidepanel for users in channel * other cleanups
This commit is contained in:
@@ -29,17 +29,15 @@ type InputState struct {
|
||||
Client *client.Client
|
||||
}
|
||||
|
||||
func NewInputBox(client *client.Client) InputState {
|
||||
func NewInputBox() InputState {
|
||||
input := textinput.NewModel()
|
||||
input.Placeholder = "Send a message..."
|
||||
input.Focus()
|
||||
state := InputState{
|
||||
Input: input,
|
||||
Style: InputboxStyle.Copy(),
|
||||
Client: client,
|
||||
}
|
||||
|
||||
return state
|
||||
return InputState{
|
||||
Input: input,
|
||||
Style: InputboxStyle.Copy(),
|
||||
}
|
||||
}
|
||||
|
||||
func (s InputState) Update(msg tea.Msg) (InputState, tea.Cmd) {
|
||||
@@ -49,6 +47,10 @@ func (s InputState) Update(msg tea.Msg) (InputState, tea.Cmd) {
|
||||
switch key {
|
||||
case "enter":
|
||||
value := s.Input.Value()
|
||||
if len(value) == 0 {
|
||||
return s, nil
|
||||
}
|
||||
|
||||
s.Input.Reset()
|
||||
|
||||
return s, s.SendingPrivMsg(value)
|
||||
|
||||
Reference in New Issue
Block a user