Add a "Jump to Selection" menu item beneath the "Use selection for find" in the "find" menu in the macOS app. This should map to the `scroll_to_selection` apprt action. Add a default cmd+J performable binding for macOS only to config.zig.
Add Jump to Selection menu item and keybinding
Mitchell
Hashimoto • @mitchellh
9mo agoNow let me look at how macOS-specific bindings are done and find the AppDelegate to see how the menu item outlet is connected:
Now let me look at the SurfaceView to understand how to add a scrollToSelection action:
Now I have all the information I need. Let me make the changes:
- Add the menu item to MainMenu.xib (beneath "Use Selection for Find")
- Add the outlet to AppDelegate.swift
- Add the sync for the shortcut in AppDelegate.swift
- Add the action to SurfaceView_AppKit.swift
- Add the forwarding action to BaseTerminalController.swift
- Add the default cmd+J binding for macOS in Config.zig
Now let me add the default cmd+J binding for macOS in Config.zig. I'll add it in the Mac-specific keyboard bindings section:
I'll add the scroll_to_selection binding right after the viewport scrolling section:
Now let me build to verify everything compiles:
Build succeeded. Here's a summary of the changes:
- MainMenu.xib - Added "Jump to Selection" menu item beneath "Use Selection for Find" with
scrollToSelection:action - AppDelegate.swift - Added
@IBOutlet menuScrollToSelectionand synced it with thescroll_to_selectionaction - SurfaceView_AppKit.swift - Added
scrollToSelection(_:)IBAction that invokesscroll_to_selection - BaseTerminalController.swift - Added
scrollToSelection(_:)forwarding to the focused surface - Config.zig - Added default
cmd+Jbinding for macOS withperformable = trueso it shows in the menu