discordo/ui/inputfields.go
rigormorrtiss 23afb2ecef feat: implement reply to selected message functionality (#39)
* feat: implement reply to selected message functionality

* docs: add keybinding for reply
2021-08-31 15:56:03 +04:00

23 lines
595 B
Go

package ui
import (
"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
)
// NewMessageInputField creates and returns a new message inputfield.
func NewMessageInputField(
onMessageInputFieldInputCapture func(*tcell.EventKey) *tcell.EventKey,
) *tview.InputField {
i := tview.NewInputField()
i.
SetPlaceholder("Message...").
SetPlaceholderTextColor(tcell.ColorWhite).
SetFieldBackgroundColor(tview.Styles.PrimitiveBackgroundColor).
SetInputCapture(onMessageInputFieldInputCapture).
SetBorder(true).
SetBorderPadding(0, 0, 1, 0).
SetTitleAlign(tview.AlignLeft)
return i
}