parent
926a00f6ac
commit
c0cb2040a0
@ -10,8 +10,6 @@ import (
|
||||
type Input struct {
|
||||
Par *termui.Par
|
||||
CursorPosition int
|
||||
CursorFgColor termui.Attribute
|
||||
CursorBgColor termui.Attribute
|
||||
}
|
||||
|
||||
// CreateInput is the constructor of the Input struct
|
||||
@ -19,8 +17,6 @@ func CreateInput() *Input {
|
||||
input := &Input{
|
||||
Par: termui.NewPar(""),
|
||||
CursorPosition: 0,
|
||||
CursorBgColor: termui.ColorBlack,
|
||||
CursorFgColor: termui.ColorWhite,
|
||||
}
|
||||
|
||||
input.Par.Height = 3
|
||||
|
@ -147,13 +147,18 @@ func actionMoveCursorLeft(view *views.View) {
|
||||
|
||||
func actionSend(ctx *context.AppContext) {
|
||||
if !ctx.View.Input.IsEmpty() {
|
||||
|
||||
// Clear message before sending, to combat
|
||||
// quick succession of actionSend
|
||||
message := ctx.View.Input.Text()
|
||||
ctx.View.Input.Clear()
|
||||
ctx.View.Refresh()
|
||||
|
||||
ctx.View.Input.SendMessage(
|
||||
ctx.Service,
|
||||
ctx.Service.Channels[ctx.View.Channels.SelectedChannel].ID,
|
||||
ctx.View.Input.Text(),
|
||||
message,
|
||||
)
|
||||
ctx.View.Input.Clear()
|
||||
ctx.View.Refresh()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user