Add methods Text.Clear and Input.Clear
This commit is contained in:
parent
8d5f5af3c5
commit
368514415e
2 changed files with 10 additions and 0 deletions
5
input.go
5
input.go
|
@ -35,6 +35,11 @@ func NewInput(prefix string, text string, onSelected func(text string) (handled
|
|||
}
|
||||
}
|
||||
|
||||
// Clear clears the field's buffer.
|
||||
func (i *Input) Clear() {
|
||||
i.field.SetText("")
|
||||
}
|
||||
|
||||
// Write writes to the field's buffer.
|
||||
func (i *Input) Write(p []byte) (n int, err error) {
|
||||
return i.field.Write(p)
|
||||
|
|
5
text.go
5
text.go
|
@ -29,6 +29,11 @@ func NewText(text string) *Text {
|
|||
}
|
||||
}
|
||||
|
||||
// Clear clears the field's buffer.
|
||||
func (t *Text) Clear() {
|
||||
t.field.SetText("")
|
||||
}
|
||||
|
||||
// Write writes to the field's buffer.
|
||||
func (t *Text) Write(p []byte) (n int, err error) {
|
||||
return t.field.Write(p)
|
||||
|
|
Loading…
Reference in a new issue