Skip to content

Conversation

@Ben-Collett
Copy link

Added support for navigating selects, when expanded, using j and k for up and down navigation similar to vi. I suspect this was meant to be how the code behaved given the presence of code that would have done that if it weren't for the fact that key inputs where being by the select widgets SelectOverlay.

class PostingSelect(Select[T], inherit_bindings=False):
    BINDINGS = [
        Binding("enter,space,l", "show_overlay", "Show Overlay", show=False),
        Binding("up,k", "cursor_up", "Cursor Up", show=False),
        Binding("down,j", "cursor_down", "Cursor Down", show=False),
    ]

    def action_cursor_up(self):
        if self.expanded:
            self.select_overlay.action_cursor_up()
        else:
            self.screen.focus_previous()

    def action_cursor_down(self):
        if self.expanded:
            self.select_overlay.action_cursor_down()
        else:
            self.screen.focus_next()

Unless that was meant for only the specific case where type_to_search was disabled.

In either case I think reserving j and k for up and down navigation is more consistent with other parts of the program.
I also enabled l and space to select the current highlighted option to match the ways that you can open the overlay. I disabled type_to_search in the MethodSelector in favor of you just being able to hit the underlined letter when the select is expanded as that is more obvious for how a user would expect the program to act given the visual Que. (previously you could only change the selection through that means with the select not expanded). You can however use type_to_search in every other selector as long as you don't search for the j, i, l, and space characters. I added support for using capital letters to navigate the method selector options as the underline letters that are underlined are all uppercase and as such could cause a point of confusion to new users.

I changed one of the svg's for one of the test as it seemed to be wrong, the test indicated that it should be a screen shot with the method being in post mode but, if I was reading the UI correctly, it was in put mode.
20251211_00h41m06s_grim

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 this pull request may close these issues.

1 participant