Skip to content

[PR1/5] feat(upstream): 安全パッチ4件取り込み - ターミナルクリップボード/サイドバートグル/CodeMirrorホットキー/エラー選択#159

Merged
MocA-Love merged 4 commits intomainfrom
upstream-merge/pr1-safe-patches
Apr 14, 2026
Merged

[PR1/5] feat(upstream): 安全パッチ4件取り込み - ターミナルクリップボード/サイドバートグル/CodeMirrorホットキー/エラー選択#159
MocA-Love merged 4 commits intomainfrom
upstream-merge/pr1-safe-patches

Conversation

@MocA-Love
Copy link
Copy Markdown
Owner

@MocA-Love MocA-Love commented Apr 14, 2026

Upstream Merge PR#1 - 安全パッチ取り込み

upstream (superset-sh/superset) から安全に取り込める4コミットを cherry-pick します。

取り込むコミット

Commit Upstream PR 内容
`d656b7efa` superset-sh#3415 ターミナルのクリップボード動作を VS Code に合わせる
`b18a00c0b` superset-sh#3421 v2 workspace の右サイドバートグルを開閉状態に対して reactive に
`b42a1143d` superset-sh#3418 CodeMirror 内でアプリ側のホットキー(Cmd+W 等)を発火できるように
`47efa7305` superset-sh#3432 pending workspace / update-required ページのエラーテキストを選択可能に

改善内容の詳細

1. ターミナルクリップボード (superset-sh#3415)

何が問題だったか:

  • 従来のターミナルでは、コピー/ペーストの挙動が VS Code と異なり、ユーザー体験が不統一だった
  • 特に macOS では Cmd+C / Cmd+V のバブリング処理が不完全で、選択範囲がないときにコピーが効かなかったり、全選択が意図せず発動したりした

どう直したか:

  • 新規ヘルパー `shouldBubbleClipboardShortcut()` と `shouldSelectAllShortcut()` を追加
  • ターミナルのクリップボード処理を VS Code のキーボードショートカット処理と完全に一致させる
  • 新規ファイル:
    • `clipboardShortcuts.ts`
    • `clipboardShortcuts.test.ts`

2. v2 右サイドバートグルの reactivity (superset-sh#3421)

何が問題だったか:

  • v2 workspace の右サイドバーの開閉トグルボタンが、外部から開閉状態が変わっても再レンダリングされず、UI が追従しない不具合

どう直したか:

  • collections API の `useLiveQuery` を使って React hook 化し、開閉状態変更で自動的に re-render されるように

3. CodeMirror 内でのホットキー発火 (superset-sh#3418)

何が問題だったか:

  • ファイルエディタ(CodeMirror)にフォーカスがあるとき、`Cmd+W` (タブを閉じる) などのアプリ全体のホットキーが発火しなかった
  • CodeMirror が contentEditable 要素を使っているため、react-hotkeys-hook のデフォルトでブロックされていた

どう直したか:

  • `useHotkey` フックで `enableOnContentEditable: true` をデフォルトに変更
  • これで CodeMirror 編集中でもアプリのグローバルホットキーが効くように

4. エラーテキストを選択可能に (superset-sh#3432)

何が問題だったか:

  • pending workspace の失敗ページや "update required" ページで、エラーメッセージのテキストが選択できず、ユーザーがサポートに連絡する際にエラー内容をコピーできなかった

どう直したか:

  • Tailwind の `select-text`, `cursor-text`, `break-words` クラスを該当箇所に追加
  • `user-select: none` を上書きしてエラーテキストを選択・コピー可能に

フォーク影響評価

  • フォーク独自の危険領域(auto-updater, quit lifecycle, GitHubSyncService, ホットキーレジストリ, tray メニュー)には一切触れていません
  • 全 cherry-pick がコンフリクトなしで自動マージ成功

テスト計画

  • ターミナルクリップボード:エディタとターミナルで Cmd+C/V が正しく動作
  • 右サイドバートグル:開閉状態変更で即座に UI が追従
  • CodeMirror ファイルエディタで Cmd+W がタブを閉じる
  • pending workspace / update-required ページのエラーテキストを選択・コピーできる

Kitenite and others added 4 commits April 15, 2026 01:06
…3415)

* Fix code TUI copy

* Handle more keyboard shortcuts

* fix(desktop): match VS Code terminal clipboard handling
…perset-sh#3421)

The hover icon swap was silently broken because isOpen was read via a
one-shot collections.get() call instead of a live query, so the component
never re-rendered when rightSidebarOpen changed.
…ditor) (superset-sh#3418)

react-hotkeys-hook skips events whose target is contentEditable unless
enableOnContentEditable is set. CodeMirror 6 renders its editor as a
contenteditable element, so app chords like cmd+w stopped firing when
focus was in the v1 file editor — meta+w never reached the CLOSE_TERMINAL
handler that closes the focused pane.

Default enableOnContentEditable: true in useHotkey, mirroring the existing
enableOnFormTags default. Callers can still opt out via options.
…rs selectable (superset-sh#3432)

Global `user-select: none` on body blocks copying error text on full-page error states. Matches the pattern already used by v1 WorkspaceInitializingView.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 14, 2026

📝 Walkthrough

Walkthrough

複数のファイルでキーボードショートカットと入力インタラクションが強化されました。ターミナルコンポーネントに選択全部およびクリップボード操作の短縮キー処理が追加され、スタイリングでテキスト選択機能が有効化され、ホットキーリスナーはコンテンツ編集可能要素での動作が改善されました。

Changes

Cohort / File(s) Summary
UI テキスト選択の改善
apps/desktop/src/renderer/components/UpdateRequiredPage/UpdateRequiredPage.tsx, apps/desktop/src/renderer/routes/_authenticated/_dashboard/pending/$pendingId/page.tsx
エラーテキストに select-textcursor-textbreak-words クラスを追加し、テキスト選択、テキストカーソル、および長いメッセージの折り返しを有効化。
ホットキー設定の拡張
apps/desktop/src/renderer/hotkeys/hooks/useHotkey/useHotkey.ts
enableOnContentEditable: true フラグを追加してコンテンツ編集可能要素上でのホットキーリスナー動作を有効化。
右サイドバーの状態管理更新
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/TopBar/components/RightSidebarToggle/RightSidebarToggle.tsx
同期的なローカルステート取得を useLiveQuery による動的クエリに置き換え、リアクティブなデータフローを実装。
ターミナルクリップボード短縮キ処理
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/clipboardShortcuts.ts, apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/clipboardShortcuts.test.ts
新しいモジュールでプラットフォーム固有のクリップボード操作(macOS Cmd+V/C、Windows Ctrl+V/C)と選択全部コマンド(Cmd+A)の判定を実装。包括的なテストスイートで各プラットフォームと条件をカバー。
ターミナルキーボードイベント処理の拡張
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/helpers.ts
setupKeyboardHandler に選択全部と新しいクリップボード短縮キーの事前処理を追加、xtermに優先させる前にホストが処理可能に。

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Terminal as Terminal Handler
    participant Interceptor as Keyboard Interceptor
    participant XTerm
    participant Host as Host Clipboard

    User->>Terminal: keydown イベント発生
    Terminal->>Interceptor: キーボードイベント渡す
    Interceptor->>Interceptor: shouldSelectAllShortcut()で判定<br/>(Cmd+A on macOS)
    alt 選択全部コマンド
        Interceptor->>XTerm: selectAll() 実行
        Interceptor-->>Terminal: 処理完了
    else shouldBubbleClipboardShortcut()で判定
        Interceptor->>Interceptor: プラットフォーム固有の<br/>クリップボード操作か判定
        alt ホストが処理すべき
            Interceptor->>Host: false を返すで<br/>ホストに処理譲渡
            Host->>Host: コピー/ペースト実行
        else XTermが処理
            Interceptor->>XTerm: デフォルト処理へ進む
        end
    else その他のキー
        Interceptor->>XTerm: 既存の処理ロジック実行
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 キーボードのタップ、響き渡る、
クリップボードはバウンド、テキストは自由に選べる、
短縮キーが踊る macOS から Windows へ、
xtermさん、もう一度のお役目です、
ホストが先陣切る、そのあとの流れで。 ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed PR の説明は詳細で、取り込むコミット一覧、改善内容の詳細(問題点と対策を含む)、フォーク影響評価、テスト計画を含んでいます。リポジトリのテンプレートと比較しても必要な情報がほぼ網羅されています。
Title check ✅ Passed The PR title describes the main changes: it covers terminal clipboard handling, sidebar toggle, CodeMirror hotkeys, and error text selection - all key aspects of the 4 upstream patches being cherry-picked.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch upstream-merge/pr1-safe-patches

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
Copy Markdown

@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.

🧹 Nitpick comments (1)
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/clipboardShortcuts.test.ts (1)

2-24: makeEvent の戻り型を明示して型追従性を上げるのを推奨します。

ClipboardShortcutEvent に将来プロパティ追加が入った時、テスト側の追従漏れをコンパイル時に検知しやすくなります。

♻️ 提案差分
 import { describe, expect, it } from "bun:test";
 import {
 	shouldBubbleClipboardShortcut,
 	shouldSelectAllShortcut,
+	type ClipboardShortcutEvent,
 } from "./clipboardShortcuts";

 function makeEvent(
 	overrides: Partial<{
 		code: string;
 		metaKey: boolean;
 		ctrlKey: boolean;
 		altKey: boolean;
 		shiftKey: boolean;
 	}>,
-) {
+): ClipboardShortcutEvent {
 	return {
 		code: "KeyC",
 		metaKey: false,
 		ctrlKey: false,
 		altKey: false,
 		shiftKey: false,
 		...overrides,
 	};
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/clipboardShortcuts.test.ts`
around lines 2 - 24, Annotate makeEvent with the explicit return type
ClipboardShortcutEvent and make its overrides parameter
Partial<ClipboardShortcutEvent> so the test will fail to compile if the event
shape drifts; import or reference ClipboardShortcutEvent from the module that
defines it (e.g., the clipboardShortcuts module), and if that type is not
exported, export it there (or create a local type alias) before using it in
makeEvent; update the function signature to return ClipboardShortcutEvent and
adjust the overrides type accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/clipboardShortcuts.test.ts`:
- Around line 2-24: Annotate makeEvent with the explicit return type
ClipboardShortcutEvent and make its overrides parameter
Partial<ClipboardShortcutEvent> so the test will fail to compile if the event
shape drifts; import or reference ClipboardShortcutEvent from the module that
defines it (e.g., the clipboardShortcuts module), and if that type is not
exported, export it there (or create a local type alias) before using it in
makeEvent; update the function signature to return ClipboardShortcutEvent and
adjust the overrides type accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ee47510b-ea09-4d2f-8405-85f7a2539d63

📥 Commits

Reviewing files that changed from the base of the PR and between 80ab6a0 and 76fea84.

📒 Files selected for processing (7)
  • apps/desktop/src/renderer/components/UpdateRequiredPage/UpdateRequiredPage.tsx
  • apps/desktop/src/renderer/hotkeys/hooks/useHotkey/useHotkey.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/TopBar/components/RightSidebarToggle/RightSidebarToggle.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/pending/$pendingId/page.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/clipboardShortcuts.test.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/clipboardShortcuts.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/Terminal/helpers.ts

@MocA-Love MocA-Love changed the title feat(upstream): safe patches - terminal clipboard, sidebar toggle, CodeMirror hotkeys, error selectable feat(upstream): 安全パッチ4件取り込み - ターミナルクリップボード/サイドバートグル/CodeMirrorホットキー/エラー選択 Apr 14, 2026
@MocA-Love MocA-Love changed the title feat(upstream): 安全パッチ4件取り込み - ターミナルクリップボード/サイドバートグル/CodeMirrorホットキー/エラー選択 [PR1/5] feat(upstream): 安全パッチ4件取り込み - ターミナルクリップボード/サイドバートグル/CodeMirrorホットキー/エラー選択 Apr 14, 2026
@MocA-Love MocA-Love merged commit 27a3bae into main Apr 14, 2026
6 checks passed
MocA-Love pushed a commit that referenced this pull request Apr 14, 2026
All 9 upstream commits have been individually cherry-picked via PR#159~#163:

| Upstream | Our PR | Description |
|---|---|---|
| d656b7e (superset-sh#3415) | #159 (PR#1) | terminal clipboard handling |
| 31fcf19 (superset-sh#3416) | #162 (PR#4) | v1 split pane startup sizing fix |
| 039edf2 (superset-sh#3403) | #161 (PR#3) | Cmd+Alt+Arrow spatial pane focus |
| b18a00c (superset-sh#3421) | #159 (PR#1) | v2 right sidebar toggle reactive |
| 3dd1de2 (superset-sh#3420) | #161 (PR#3) | v2 diff viewer + tab title resolution |
| b42a114 (superset-sh#3418) | #159 (PR#1) | CodeMirror hotkey enablement |
| c925f4d (superset-sh#3422) | #160 (PR#2) | unbound defaults + restore prev/next tab/workspace |
| bb12c09 (superset-sh#3419) | #163 (PR#5) | version bump 1.5.3 |
| 47efa73 (superset-sh#3432) | #159 (PR#1) | pending/update-required error selectable |

Fork-specific features preserved:
- auto-updater (IS_FORK, GitHub Releases API)
- QuitMode/cleanupMainWindowResources lifecycle
- GitHubSyncService, SpreadsheetViewer
- BROWSER_RELOAD / BROWSER_HARD_RELOAD / SEARCH_IN_FILES hotkeys
- HotkeyCategory "Browser"
- v1 deep-link navigation (useSearch/WorkspaceSearchParams)
- v1 tRPC-based PREV/NEXT_WORKSPACE handlers
- v1 CLOSE_TERMINAL/CLOSE_TAB hotkey handlers
- v2 extra state (rightSidebarOpenViewWidth, showPresetsBar)
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.

3 participants