Add Jump to Selection menu item and keybinding

ghostty
Medium
Unlisted
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.
Explored 3 files, 5 searches

Now let me look at how macOS-specific bindings are done and find the AppDelegate to see how the menu item outlet is connected:

Explored 3 files, 1 search

Now let me look at the SurfaceView to understand how to add a scrollToSelection action:

Explored 2 files

Now I have all the information I need. Let me make the changes:

  1. Add the menu item to MainMenu.xib (beneath "Use Selection for Find")
  2. Add the outlet to AppDelegate.swift
  3. Add the sync for the shortcut in AppDelegate.swift
  4. Add the action to SurfaceView_AppKit.swift
  5. Add the forwarding action to BaseTerminalController.swift
  6. Add the default cmd+J binding for macOS in Config.zig
Edited 4 files (+20)

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:

Explored 1 file

I'll add the scroll_to_selection binding right after the viewport scrolling section:

Edited 1 file (+6)

Now let me build to verify everything compiles:

Ran 1 command

Build succeeded. Here's a summary of the changes:

  1. MainMenu.xib - Added "Jump to Selection" menu item beneath "Use Selection for Find" with scrollToSelection: action
  2. AppDelegate.swift - Added @IBOutlet menuScrollToSelection and synced it with the scroll_to_selection action
  3. SurfaceView_AppKit.swift - Added scrollToSelection(_:) IBAction that invokes scroll_to_selection
  4. BaseTerminalController.swift - Added scrollToSelection(_:) forwarding to the focused surface
  5. Config.zig - Added default cmd+J binding for macOS with performable = true so it shows in the menu