~whereswaldon/rosebud

aeb4309b6090ea62d4cd2230762f809c6ccc0131 — Chris Waldon 1 year, 2 months ago 8f37bc5
appwidget: fix text insertion

This commit ensures that applying a suggestion results in the cursor being
at the end of the text, not the beginning.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
1 files changed, 2 insertions(+), 1 deletions(-)

M appwidget/tx-editor.go
M appwidget/tx-editor.go => appwidget/tx-editor.go +2 -1
@@ 152,7 152,8 @@ func (e *TxEditor) SetSuggestions(suggestions []string) {
// hyperlink to the suggested entry.
func (e *TxEditor) applySuggestion(event SuggestionAcceptedEvent[string]) {
	e.suggesting = false
	e.Editor.SetText(event.Suggestion)
	e.Editor.SetCaret(0, e.Editor.Len())
	e.Editor.Insert(event.Suggestion)
	e.appliedSuggestion = event.Suggestion
	e.externalEvents = append(e.externalEvents, TxChangedEvent{})
}