Skip to content
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

List's setSize method should also call updateKeybindings #606

Open
michaelriri opened this issue Aug 30, 2024 · 0 comments · May be fixed by #623
Open

List's setSize method should also call updateKeybindings #606

michaelriri opened this issue Aug 30, 2024 · 0 comments · May be fixed by #623

Comments

@michaelriri
Copy link

michaelriri commented Aug 30, 2024

Describe the bug

Keybindings are not updated (enabled/disabled) after resizing the height of a list.

To Reproduce

You can see this behavior by calling SetHeight in the list-simple example.

func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
	switch msg := msg.(type) {
	case tea.WindowSizeMsg:
		m.list.SetWidth(msg.Width)
		m.list.SetHeight(msg.Height - 1)
...

Expected behavior

The keybindings should update according to the List's height. For example, if there is only one page, then disable next page and prev page bindings.

Screenshots

image

Note

The next page & prev page keybindings are still enabled, even though there is only one page.

Additional context

As a workaround, you can force the keybindings to update by calling SetFilteringEnabled which will, in turn, call updateKeybindings, but this is hacky. It seems like the straightforward fix is to also call updateKeybindings in setSize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant