mirror of
https://github.com/rivo/tview.git
synced 2026-04-27 22:05:53 +03:00
[GH-ISSUE #1071] Instability/Inconsistency of grid, Newbutton Output #775
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#775
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 @WhipMeHarder on GitHub (Jan 13, 2025).
Original GitHub issue: https://github.com/rivo/tview/issues/1071
The following experimental code is being reported - as seen below, which seems to produce component output instability and inconsistency. When used, there is no reliability that the movement or appearance of the selected button's blue background will follow the up and down input of the arrow keys from the keyboard. The top and first button is supposed to be selected. This happens intermittently, as does the selection of buttons when using the keyboard.
Various experiments have been done to:
However, regardless of what methods are used, the output results always remain the same and haphazard. Is there a way to make the interactive output stable?
@rivo commented on GitHub (Mar 29, 2025):
The following line in your code
creates a new variable with the new button. But the scope of this variable extends only until the end of the function. So you're actually not updating your global
suprvariable with this. Thus, you end up always removing the same button that does not exist anymore after the first deletion. It has no effect.There are Golang linters who can catch this mistake. You might want to look into them.
Other than that, I would also say, maybe try to avoid deleting and creating elements on the fly like that. Maybe what you really want is to call
SetDisabled(). Or maybe just switch the focus usingSetFocus(). Have a look at theFormimplementation. It switches between different elements, similarly to what you're doing. Or maybe just useFormdirectly, then you don't have to worry about it.@WhipMeHarder commented on GitHub (May 8, 2025):
Ok. Thank you for giving such an insightful understanding. I will definitely look into this.
@rivo commented on GitHub (Aug 27, 2025):
Will close this for now. Feel to open a new issue if needed.