-
Notifications
You must be signed in to change notification settings - Fork 815
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
DataTable navigation updates #4633
Conversation
Binding("up,k", "cursor_up", "Cursor Up", show=False), | ||
Binding("down,j", "cursor_down", "Cursor Down", show=False), | ||
Binding("right,l", "cursor_right", "Cursor Right", show=False), | ||
Binding("left,h", "cursor_left", "Cursor Left", show=False), | ||
Binding("pageup", "page_up", "Page Up", show=False), | ||
Binding("pagedown", "page_down", "Page Down", show=False), | ||
Binding("g", "scroll_top", "Top", show=False), | ||
Binding("G", "scroll_bottom", "Bottom", show=False), | ||
Binding("home", "scroll_home", "Home", show=False), | ||
Binding("end", "scroll_end", "End", show=False), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some common bindings, particularly for horizontal navigation which I found to be lacking when using the keyboard.
Binding("ctrl+pageup", "page_left", "Page Left", show=False), | ||
Binding("ctrl+pagedown", "page_right", "Page Right", show=False), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Horizontally navigating widgets can be a bit slow when using the keyboard.
If you hold ctrl and use the scroll wheel, it applies it in the horizontal direction. So, I thought maybe we could have that apply to pageup/pagedown too.
def action_scroll_home(self) -> None: | ||
"""Move the cursor and scroll to the leftmost column.""" | ||
self._set_hover_cursor(False) | ||
cursor_type = self.cursor_type | ||
if self.show_cursor and (cursor_type == "cell" or cursor_type == "column"): | ||
self.move_cursor(column=0) | ||
else: | ||
self.scroll_x = 0 | ||
|
||
def action_scroll_end(self) -> None: | ||
"""Move the cursor and scroll to the rightmost column.""" | ||
self._set_hover_cursor(False) | ||
cursor_type = self.cursor_type | ||
if self.show_cursor and (cursor_type == "cell" or cursor_type == "column"): | ||
self.move_cursor(column=len(self.columns) - 1) | ||
else: | ||
self.scroll_x = self.max_scroll_x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quickly jumping to the first/last cell in a row. Also intended to improve horizontal navigation with the keyboard.
Updates the pageup/pagedown behaviour in the DataTable to match the TextArea widget (and Google Sheets!).
Adds some extra bindings to DataTable, particularly around horizontal navigation.