From 8e0a86e5c71ed50925a6548bc6ffdd24786ed01d Mon Sep 17 00:00:00 2001 From: Leandro Dorileo Date: Tue, 20 Mar 2018 14:54:52 -0700 Subject: [PATCH] edit: reset the cursor position Whenever changing an edit' content with SetTitle() method the cursor position must also be updated, otherwise the cursor will be placed based on previous content. --- edit.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/edit.go b/edit.go index 2d6ee7d..581dfe2 100644 --- a/edit.go +++ b/edit.go @@ -34,6 +34,10 @@ func (e *EditField) setTitleInternal(title string) { e.onChange(ev) } } + + if title == "" { + e.cursorPos = xs.Len(title) + } } // Repaint draws the control on its View surface