Fix issue with tabbed content underline #2274
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I did some investigation around #2229 and I figured out the issue is related to the fact that it takes a lot of time to swap in and out the contents of the tabbed content.
Commenting out this line makes the issue go away:
textual/src/textual/widgets/_tabbed_content.py
Line 188 in c249548
That's called when the message
Tabs.TabActivated
is handled inTabbedContent
, and that message is coming fromTabs.watch_active
.A simple fix would be to throttle
Tabs.watch_active
so that it doesn't get called too often.That is what this PR does, and merging it will close #2229.
Another possible solution, that is more involved, is to add a task-based mechanism around swapping the visible sub-widget of the
ContentSwitcher
inContentSwitch.watch_current
, such that when we schedule a new switch, old ones get thrown away.