From d6599473549aa8aee16106c0b80634d6510014dd Mon Sep 17 00:00:00 2001 From: Hubert Hirtz Date: Tue, 13 Jul 2021 21:43:49 +0200 Subject: Don't send typing=done when input is already empty --- ui/editor.go | 6 +++--- ui/ui.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'ui') diff --git a/ui/editor.go b/ui/editor.go index 15785e8..a714587 100644 --- a/ui/editor.go +++ b/ui/editor.go @@ -164,16 +164,16 @@ func (e *Editor) Flush() (content string) { return } -func (e *Editor) Clear() { +func (e *Editor) Clear() bool { if e.TextLen() == 0 { - return + return false } e.text[e.lineIdx] = []rune{} e.textWidth = e.textWidth[:1] e.cursorIdx = 0 e.offsetIdx = 0 e.autoCache = nil - return + return true } func (e *Editor) Right() { diff --git a/ui/ui.go b/ui/ui.go index 6fe0798..03a0aee 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -236,8 +236,8 @@ func (ui *UI) InputEnter() (content string) { return ui.e.Flush() } -func (ui *UI) InputClear() { - ui.e.Clear() +func (ui *UI) InputClear() bool { + return ui.e.Clear() } func (ui *UI) Resize() { -- cgit v1.2.3