Skip to content

[Bug] Edit menu commands do nothing in active terminal #56

Description

@htazq

Summary

The commands under the top Edit menu appear enabled when an SSH
terminal is active, but clicking them has no effect.

Affected items include:

  • Copy
  • Paste
  • Cut
  • Select All
  • Find
  • Find Next
  • Find Previous
  • Clear Screen

The keyboard shortcut for Find (Ctrl+F) works correctly and opens the
terminal search bar. Therefore, the terminal-side search implementation
itself is functional. The top menu commands are not connected to the
active PtyTerminal instance.

Steps to reproduce

  1. Start R-Shell on Windows.
  2. Open an SSH connection.
  3. Ensure the terminal tab is active.
  4. Open Edit.
  5. Click Find or another command in the Edit menu.

Actual behavior

The menu closes, but no terminal action occurs and no error is displayed.

For example, clicking Edit → Find does not display the search bar,
while pressing Ctrl+F works correctly.

Expected behavior

The Edit menu should operate on the currently active terminal:

  • Find should behave the same as Ctrl+F and focus the search input.
  • Find Next / Find Previous should navigate the current query.
  • Copy / Paste / Select All / Clear Screen should invoke the
    corresponding operation on the active terminal.
  • Commands that are not implemented or not applicable should be disabled
    instead of appearing clickable.

Code analysis

MenuBar exposes callbacks such as onCopy, onPaste, onSelectAll,
and onFind, and binds some menu items to these callbacks.

However, App.tsx creates <MenuBar> without supplying these
terminal-operation callbacks.

Other Edit menu items, including Cut, Find Next, Find Previous, and Clear
Screen, currently have no onClick handler in menu-bar.tsx.

By contrast, PtyTerminal handles Ctrl+F locally by setting
searchVisible, which explains why the shortcut works while the top
menu item does not.

Suggested fix

Add a command bridge from App.tsx / MenuBar to the currently active
PtyTerminal, using the existing terminal callback context or a
dedicated active-terminal command context/ref.

Only the terminal whose group and tab are currently active should execute
the command, especially when split view is enabled.

Acceptance criteria

  • Clicking Edit → Find behaves exactly like Ctrl+F.
  • The search input automatically receives focus.
  • Edit commands target only the active terminal in split view.
  • Unsupported actions are disabled instead of silently doing nothing.
  • Tests cover MenuBar-to-active-terminal command dispatch.
Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions