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-02 03:06:45 +00:00
committed by GitHub
parent faca128304
commit 79f3cb1225
12 changed files with 308 additions and 204 deletions
+1
View File
@@ -4311,6 +4311,7 @@ mod tests {
"icon_theme_selector",
"jj",
"journal",
"keymap_editor",
"language_selector",
"lsp_tool",
"markdown",
+6 -12
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))