Skip to content

Conversation

@srikary12
Copy link
Contributor

@srikary12 srikary12 commented Oct 17, 2025

Issue

Link to related issue(s):


Description

Adds Ctrl +c, Ctrl +v and Ctrl + Shift + C support


Scope of Change

Select all applicable areas impacted by this PR:

  • View (UI/UX)
  • API
  • CLI
  • Infra / Deployment
  • Docs
  • Other (specify): ________

Screenshot / Video / GIF (if applicable)

Screen.Recording.2025-10-20.at.7.49.32.AM.mov

Developer Checklist

To be completed by the developer who raised the PR.

  • Add valid/relevant title for the PR
  • Self-review done
  • Manual dev testing done
  • No secrets exposed
  • No merge conflicts
  • Docs added/updated (if applicable)
  • Removed debug prints / secrets / sensitive data
  • Unit / Integration tests passing
  • Follows all standards defined in Nixopus Docs

Reviewer Checklist

To be completed by the reviewer before merge.

  • Peer review done
  • No console.logs / fmt.prints left
  • No secrets exposed
  • If any DB migrations, migration changes are verified
  • Verified release changes are production-ready

Summary by CodeRabbit

  • New Features

    • Copy terminal selection to clipboard with Ctrl/Cmd+C
  • Bug Fixes

    • More robust clipboard handling with error protection when copying
  • Behavior Changes

    • Stop/interrupt shortcut now requires Ctrl/Cmd+Shift+C (narrowed trigger)
    • Retains paste with Ctrl/Cmd+V and suppression of conflicting key combos
  • Chores

    • Updated development compose configuration identifier (non-functional)

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 17, 2025

Walkthrough

Adds Ctrl/Cmd+C handling to the terminal hook to copy the current selection (with error handling and selection clearing) and preserves Ctrl/Cmd+J suppression; narrows the StopExecution shortcut to require Shift; renames a docker-compose service from supertokens to nixopus-supertokens.

Changes

Cohort / File(s) Change Summary
Terminal key handling
view/app/terminal/utils/useTerminal.ts
Added Ctrl/Cmd+C handling on keydown to copy the terminal selection via the Clipboard API (try/catch and error logging), clear selection on success, consolidate key checks, retain existing Ctrl/Cmd+J suppression, and return false to suppress default actions. Public API unchanged.
StopExecution shortcut
view/app/terminal/utils/stopExecution.ts
Tightened keyboard shortcut: StopExecution now requires Shift + Ctrl/Cmd + C (previously Ctrl/Cmd + C). Adjusted keydown condition accordingly.
Dev compose service rename
docker-compose-dev.yml
Renamed service identifier from supertokens to nixopus-supertokens and updated dependent references; service configuration otherwise unchanged.

Sequence Diagram(s)

sequenceDiagram
  participant UI as Terminal UI
  participant Hook as useTerminal hook
  participant Clip as Clipboard API
  participant Term as Terminal backend

  Note over UI,Hook: User presses keys
  UI->>Hook: keydown (Ctrl/Cmd + C)
  alt Selection exists & Shift not required
    Hook->>Clip: writeText(selection) color:#4CAF50
    Clip-->>Hook: success
    Hook->>UI: clear selection
    Hook-->>UI: return false (suppress default)
  else Ctrl/Cmd + J
    Hook-->>UI: suppress (return false) color:#FFC107
  else Other keys
    Hook->>Term: forward key event
  end
Loading
sequenceDiagram
  participant UI as Terminal UI
  participant Stop as stopExecution
  participant Term as Terminal backend

  UI->>Stop: keydown (Ctrl/Cmd + C [+/- Shift])
  alt Shift pressed
    Stop->>Term: trigger stop execution
  else Shift not pressed
    Stop-->>UI: ignore (no-op)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

nixopus-view

Suggested reviewers

  • zhravan

Poem

🐰
Tiny paws tap keys in glee,
Ctrl and C set snippets free.
Clipboard hops from screen to spoon,
Shift now guards the stop cocoon.
Joyful bytes and carrot tea! 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "feat: add clipboard support for terminal input and output" is clearly related to the primary changes in the changeset. The documented modifications to useTerminal.ts implement Ctrl/Cmd + C for clipboard copy of terminal selections, and stopExecution.ts modifies the keyboard shortcut handling to include Shift for the stop action. The PR objectives explicitly state support for "Ctrl+c, Ctrl+v and Ctrl+Shift+C in the terminal," which aligns with the title's theme of clipboard support. While the title is somewhat broad and doesn't capture specific implementation details (such as the shift-key requirement change), it accurately conveys the main intent and focus of the changeset. The title is concise, clear, and would help teammates scanning the history understand that this change introduces terminal clipboard functionality.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 24e5ba4 and 03f4c88.

📒 Files selected for processing (1)
  • view/app/terminal/utils/useTerminal.ts (1 hunks)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docker-compose-dev.yml (1)

28-28: Critical: Update connection URI to match the renamed service.

The SUPERTOKENS_CONNECTION_URI still references the old service name supertokens, but the service was renamed to nixopus-supertokens on line 108. Docker Compose DNS resolution uses service names, not container names, so this will cause the API to fail when attempting to connect to SuperTokens.

Apply this diff to fix the connection URI:

-      - SUPERTOKENS_CONNECTION_URI=http://supertokens:3567
+      - SUPERTOKENS_CONNECTION_URI=http://nixopus-supertokens:3567
🧹 Nitpick comments (1)
view/app/terminal/utils/stopExecution.ts (1)

9-9: Consider removing or replacing the console.log statement.

The console.log('Stopped execution') statement appears to be debug code. Consider removing it or replacing it with a proper logging mechanism if needed for production debugging.

Apply this diff to remove the console.log:

-        console.log('Stopped execution');
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 03f4c88 and 7654d44.

📒 Files selected for processing (3)
  • docker-compose-dev.yml (1 hunks)
  • view/app/terminal/utils/stopExecution.ts (1 hunks)
  • view/app/terminal/utils/useTerminal.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • view/app/terminal/utils/useTerminal.ts
🔇 Additional comments (1)
view/app/terminal/utils/stopExecution.ts (1)

7-7: LGTM! Shift key requirement correctly separates clipboard copy from stop execution.

The addition of && e.shiftKey appropriately narrows the stop execution shortcut to Ctrl/Cmd+Shift+C, freeing up Ctrl/Cmd+C for clipboard copy operations handled in useTerminal.ts.

Copy link
Collaborator

@zhravan zhravan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, revert the docker-compose file change for now.

cc: @raghavyuva

@zhravan zhravan merged commit 8ad6a1c into raghavyuva:master Oct 22, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants