mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[GH-ISSUE #908] InputField calls changed function three times when using .SetText #663
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#663
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 @vitorqb on GitHub (Nov 1, 2023).
Original GitHub issue: https://github.com/rivo/tview/issues/908
Hi 👋, thanks for this great library.
Using the latest version (
github.com/rivo/tview v0.0.0-20231031172508-2dfe06011790) I have found an inconsistent behavior for InputField. I believe it was introduced at commit 6416d6b.When calling
.SetTexton an InputField, thechangedfunction gets called three times.Here is a repo that reproduces the issue: https://github.com/vitorqb/tview-bug
Here is the base snippet:
Which prints
As you can see the function given to
SetChangedFuncwas called 3 times with the same string, even though the input just changed once (call to.SetText). I expected it to be called only once.@rivo commented on GitHub (Nov 2, 2023):
Thank you for letting me know about this. Yes, there were indeed a few too many calls to the "changed" callback in the code. The latest commit should fix this.