-
Notifications
You must be signed in to change notification settings - Fork 851
fix(tui): fix list wrap behave when it has unfocusable items #1312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the Contributor License Agreement (CLA) and hereby sign the CLA. |
|
thanks for that - it is great, these little annoying things |
|
@dawndiy thanks for the PR and the fix, I am wondering if it would be better to jump the viewport to the first un-selectable item instead of the selectable item so that we actually go to the top? So for example here instead of hiding the |
|
@kujtimiihoxha thanks your reply. Of cause it would be better to show the un-selectable item (provider name in this case), it will more readable. Let me describe my use case about this issue: Following your advice, I believe the following 2 points are our final desired outcomes.
And I found that I can add these code to the end of the selectedIndex, ok := l.indexMap.Get(l.selectedItem)
if ok && selectedIndex > 0 {
prevItem, ok := l.items.Get(selectedIndex - 1)
if ok {
if _, ok := any(prevItem).(layout.Focusable); !ok {
prevRendered, ok := l.renderedItems.Get(prevItem.ID())
if ok && prevRendered.start < start {
if l.direction == DirectionForward {
l.offset = max(0, prevRendered.start)
} else {
l.offset = max(0, lipgloss.Height(l.rendered)-(prevRendered.end+1))
}
}
}
}
}It works, but I don't know if this is the correct way to fix this issue and match the 2 points above. |
|
Finally , I think this PR can fix the list wrap issue when it has un-selectable sections.
Current: Screen.Recording.2025-11-08.at.3.40.54.AM.movThis PR: Screen.Recording.2025-11-08.at.3.42.38.AM.mov
Current: Screen.Recording.2025-11-08.at.3.50.16.AM.movThis PR: Screen.Recording.2025-11-08.at.3.49.22.AM.mov |
CONTRIBUTING.md.At the Switch Model dialog, models were grouped by the provider. Each section has a unfocusable name of the provider.
If I go down when at the last item, it will come to the top model, but It will not come to the last model when I go up at the first item. Because there is a provider name ( a list item ) before the first model. The list wrap logic is not adapter this scene.
This PR fix list wrap logic in this scene.