[PR #518] [CLOSED] feat: add text selection and copy functionality to TUI #9638

Closed
opened 2026-02-16 18:13:54 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/518
Author: @BurgessTG
Created: 6/28/2025
Status: Closed

Base: devHead: feat/text-selection-copy


📝 Commits (10+)

  • 36c76fc feat: Add interactive scrollbar to chat interface
  • 955ed63 fix: merge with dev branch scroll tracking changes
  • deb2e27 fix: complete merge with dev branch
  • f498624 Merge branch 'dev' into feat/interactive-scrollbar
  • 20aee66 feat: add text selection and copy functionality to TUI
  • 597768b fix: improve text extraction and cleaning for clipboard
  • 5b2832d fix: handle UTF-8 characters properly in text selection highlighting
  • 39ae605 feat: add Aiken language server support for Cardano smart contracts
  • ee693a5 Revert "feat: add Aiken language server support for Cardano smart contracts"
  • b8483dd feat: Add height-limited text input with viewport scrolling

📊 Changes

13 files changed (+2416 additions, -37 deletions)

View changed files

.husky/pre-commit (+1 -0)
AGENTS.md (+751 -0)
opencode-dev (+0 -0)
opencode-dev-launcher.sh (+10 -0)
📝 packages/tui/go.mod (+1 -1)
📝 packages/tui/internal/commands/command.go (+18 -1)
📝 packages/tui/internal/components/chat/editor.go (+442 -6)
📝 packages/tui/internal/components/chat/messages.go (+772 -13)
📝 packages/tui/internal/components/qr/qr.go (+1 -1)
📝 packages/tui/internal/components/textarea/textarea.go (+300 -8)
📝 packages/tui/internal/tui/tui.go (+120 -7)
packages/tui/opencode (+0 -0)
packages/tui/opencode-dev (+0 -0)

📄 Description

Summary

  • Adds click-and-drag text selection with visual highlighting
  • Implements copy to clipboard functionality via OSC52
  • Supports both single-line and multi-line selection

Features

  • Mouse Selection: Click and drag to select text
  • Visual Feedback: Selected text is highlighted with system-appropriate colors
  • Multi-line Support: Select across multiple lines seamlessly
  • Clean Copy: Text is copied without ANSI escape codes
  • Keyboard Shortcuts: Ctrl+Shift+C or Ctrl+Y to copy
  • Constrained Highlighting: Highlight stays within content boundaries

Implementation Details

  • Uses OSC52 escape sequences for clipboard integration
  • Handles centered content layout with proper coordinate mapping
  • Strips ANSI codes for clean clipboard content
  • Visual highlight uses muted system colors for better UX

Test Plan

  1. Run OpenCode TUI
  2. Click and drag to select text (single or multi-line)
  3. Press Ctrl+Shift+C or Ctrl+Y to copy
  4. Paste in another application - text should be clean without formatting codes
  5. Verify highlight doesn't spill outside content area

Screenshots

The selection highlight uses system-appropriate muted colors and stays within content boundaries:

  • Single-line selection works with proper visual feedback
  • Multi-line selection maintains alignment and formatting
  • Highlight color is subtle and doesn't interfere with readability

🤖 Generated with opencode


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/518 **Author:** [@BurgessTG](https://github.com/BurgessTG) **Created:** 6/28/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `feat/text-selection-copy` --- ### 📝 Commits (10+) - [`36c76fc`](https://github.com/anomalyco/opencode/commit/36c76fc2bf2bb9a525d4396eda0eb254268bc4e8) feat: Add interactive scrollbar to chat interface - [`955ed63`](https://github.com/anomalyco/opencode/commit/955ed631c3e6a51760000150aee8e00e1151f753) fix: merge with dev branch scroll tracking changes - [`deb2e27`](https://github.com/anomalyco/opencode/commit/deb2e27c924aab94df90b273398679bde720b1aa) fix: complete merge with dev branch - [`f498624`](https://github.com/anomalyco/opencode/commit/f498624112b18318574df984a7909b5be40ec2d0) Merge branch 'dev' into feat/interactive-scrollbar - [`20aee66`](https://github.com/anomalyco/opencode/commit/20aee66528df63903e0f7a171cdcf2c72634915c) feat: add text selection and copy functionality to TUI - [`597768b`](https://github.com/anomalyco/opencode/commit/597768b12a9824c12f3632c5aec76b5f3cb934bb) fix: improve text extraction and cleaning for clipboard - [`5b2832d`](https://github.com/anomalyco/opencode/commit/5b2832d0c459cb56f667aaa90b3c1d6984f3c009) fix: handle UTF-8 characters properly in text selection highlighting - [`39ae605`](https://github.com/anomalyco/opencode/commit/39ae605951189e1405002237b48d53956e6a788a) feat: add Aiken language server support for Cardano smart contracts - [`ee693a5`](https://github.com/anomalyco/opencode/commit/ee693a59a678f86b3bcbb0b204f361371c994d4d) Revert "feat: add Aiken language server support for Cardano smart contracts" - [`b8483dd`](https://github.com/anomalyco/opencode/commit/b8483dde996a574d3ea654ac074657b7f155724b) feat: Add height-limited text input with viewport scrolling ### 📊 Changes **13 files changed** (+2416 additions, -37 deletions) <details> <summary>View changed files</summary> ➕ `.husky/pre-commit` (+1 -0) ➕ `AGENTS.md` (+751 -0) ➕ `opencode-dev` (+0 -0) ➕ `opencode-dev-launcher.sh` (+10 -0) 📝 `packages/tui/go.mod` (+1 -1) 📝 `packages/tui/internal/commands/command.go` (+18 -1) 📝 `packages/tui/internal/components/chat/editor.go` (+442 -6) 📝 `packages/tui/internal/components/chat/messages.go` (+772 -13) 📝 `packages/tui/internal/components/qr/qr.go` (+1 -1) 📝 `packages/tui/internal/components/textarea/textarea.go` (+300 -8) 📝 `packages/tui/internal/tui/tui.go` (+120 -7) ➕ `packages/tui/opencode` (+0 -0) ➕ `packages/tui/opencode-dev` (+0 -0) </details> ### 📄 Description ## Summary - Adds click-and-drag text selection with visual highlighting - Implements copy to clipboard functionality via OSC52 - Supports both single-line and multi-line selection ## Features - **Mouse Selection**: Click and drag to select text - **Visual Feedback**: Selected text is highlighted with system-appropriate colors - **Multi-line Support**: Select across multiple lines seamlessly - **Clean Copy**: Text is copied without ANSI escape codes - **Keyboard Shortcuts**: `Ctrl+Shift+C` or `Ctrl+Y` to copy - **Constrained Highlighting**: Highlight stays within content boundaries ## Implementation Details - Uses OSC52 escape sequences for clipboard integration - Handles centered content layout with proper coordinate mapping - Strips ANSI codes for clean clipboard content - Visual highlight uses muted system colors for better UX ## Test Plan 1. Run OpenCode TUI 2. Click and drag to select text (single or multi-line) 3. Press `Ctrl+Shift+C` or `Ctrl+Y` to copy 4. Paste in another application - text should be clean without formatting codes 5. Verify highlight doesn't spill outside content area ## Screenshots The selection highlight uses system-appropriate muted colors and stays within content boundaries: - Single-line selection works with proper visual feedback - Multi-line selection maintains alignment and formatting - Highlight color is subtle and doesn't interfere with readability 🤖 Generated with [opencode](https://opencode.ai) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:13:54 -05:00
yindo closed this issue 2026-02-16 18:13:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9638