This commit is contained in:
5684185+vsariola@users.noreply.github.com
2025-10-15 23:12:43 +03:00
parent e5a2fbec51
commit 0bd652dcbb
8 changed files with 212 additions and 14 deletions

View File

@ -66,7 +66,13 @@ func (e *Editor) Layout(gtx C, str tracker.String, th *Theme, style *EditorStyle
// just consume all events if the user did not consume them
}
if e.widgetEditor.Text() != str.Value() {
line, col := e.widgetEditor.CaretPos()
// if the user has moved the caret, put it in the end
e.widgetEditor.SetText(str.Value())
if line > 0 || col > 0 {
l := len(e.widgetEditor.Text())
e.widgetEditor.SetCaret(l, l)
}
}
me := material.Editor(&th.Material, &e.widgetEditor, hint)
me.Font = style.Font