mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[GH-ISSUE #1110] Bug: InputField SetChangedFunc callback gets called twice #807
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#807
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kivattt on GitHub (Aug 17, 2025).
Original GitHub issue: https://github.com/rivo/tview/issues/1110
When you set a callback function with
inputField.SetChangedFunc(), the callback is called twice instead of once on every change to the text.I believe this was introduced with
github.com/rivo/tview@8b7bcf9883This code in
NewInputField()forwards the changed function to the InputField's TextArea:But the code in InputField's
InputHandler()duplicates that call to changed:I think the solution is to remove the duplicate call to
i.changed()in theInputHandler()forinputfield.goCode to reproduce this bug:
I wrote 3 letters, but the callback was called 6 times
@rivo commented on GitHub (Aug 27, 2025):
Thanks. Fixed it in the latest commit.