keymap_ui: Add context menu for table rows (#33747)

Closes #ISSUE

Adds a right click context menu to table rows, refactoring the table API
to support more general row rendering in the process, and creating
actions for the couple of operations available in the context menu.

Additionally includes an only partially related change to the context
menu API, which makes it easier to have actions that are disabled based
on a boolean value.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Ben Kunkle 2025-07-01 22:06:45 -05:00 committed by GitHub
parent faca128304
commit 79f3cb1225
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 308 additions and 204 deletions

View file

@ -4311,6 +4311,7 @@ mod tests {
"icon_theme_selector",
"jj",
"journal",
"keymap_editor",
"language_selector",
"lsp_tool",
"markdown",

View file

@ -258,18 +258,12 @@ impl Render for QuickActionBar {
.action("Next Problem", Box::new(GoToDiagnostic))
.action("Previous Problem", Box::new(GoToPreviousDiagnostic))
.separator()
.map(|menu| {
if has_diff_hunks {
menu.action("Next Hunk", Box::new(GoToHunk))
.action("Previous Hunk", Box::new(GoToPreviousHunk))
} else {
menu.disabled_action("Next Hunk", Box::new(GoToHunk))
.disabled_action(
"Previous Hunk",
Box::new(GoToPreviousHunk),
)
}
})
.action_disabled_when(!has_diff_hunks, "Next Hunk", Box::new(GoToHunk))
.action_disabled_when(
!has_diff_hunks,
"Previous Hunk",
Box::new(GoToPreviousHunk),
)
.separator()
.action("Move Line Up", Box::new(MoveLineUp))
.action("Move Line Down", Box::new(MoveLineDown))