From b8d8193a3871fb01e47d50b0d8536fdc81861082 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Tue, 16 Sep 2025 10:06:41 +1000 Subject: [PATCH] Copy startup terminal (#5585) * Add copyTerminal translation key * Add copy terminal button with select all functionality * Remove copy button from error view button group * Add hover-based copy button overlay to terminal * Fix clipboard copy implementation in BaseTerminal * Add 'Copy all' tooltip to terminal copy button * Fix copy button to be away from right hand side * Update copy button to respect existing selection - Copy only selected text if any exists - Copy all text and clear selection if nothing selected - Update tooltip to reflect new behavior * Add dynamic tooltip showing actual copy action - Show 'Copy selection' when text is selected - Show 'Copy all' when no text is selected * Remove redundant i18n * Fix aria-label to use dynamic tooltip text * Remove debug console.error statements from useTerminal Clean up debug logging added during development: - Remove selection change debug logging - Remove focus state debug logging - Remove keyboard event debug logging - Remove copy/paste debug logging * Remove redundant keyboard handling from useTerminal The rebase commit already fixed basic copy/paste. Removed only the complex keyboard event handling that duplicates the rebase fix. Kept the valuable UI features: - Hover copy button overlay - Right-click context menu * Use Tailwind transition classes instead of custom CSS Replace custom .animate-fade-in with standard Tailwind transition-opacity duration-200 classes * Use VueUse useElementHover for robust hover handling Replace manual mouseenter/mouseleave events with VueUse useElementHover composable which properly handles all edge cases including mouseout and interrupted events * Move tooltip to left of button Relieves squished tooltip * Simplify code * Fix listener lifecycle management Consolidate setup into single onMounted block instead of creating unnecessary duplicate lifecycle hooks * Replace any type with proper IDisposable type * Refactor copy logic for clarity * Use v-show for proper opacity transitions * Prefer optional chaining * Use useEventListener for context menu * Remove redundant opacity classes * Add BaseTerminal component tests * Use pointer-events for button interactivity * Update tests for pointer-events button behavior * Fix clipboard mock in tests * Fix test expectations for opacity classes * Simplify hover tests for button state * Remove low-value 'renders terminal container' test * Remove non-functional 'button responds to hover' test * Remove implementation detail test for dispose listener * Remove redundant 'tracks selection changes' test * Remove obvious comments from test file * Use cn() utility for conditional classes * Update tests-ui/tests/components/bottomPanel/tabs/terminal/BaseTerminal.spec.ts Co-authored-by: Alexander Brown * [auto-fix] Apply ESLint and Prettier fixes * Remove 'any' types from wrapper and terminalMock variables Add assertion to verify onSelectionChange was called * Move mountBaseTerminal factory to module scope * Rename test file - Current consensus is .test.ts for component files * Update src/components/bottomPanel/tabs/terminal/BaseTerminal.vue * nit --------- Co-authored-by: Alexander Brown Co-authored-by: GitHub Action --- .../tabs/terminal/BaseTerminal.vue | 71 +++++- src/locales/en/main.json | 2 + .../tabs/terminal/BaseTerminal.test.ts | 218 ++++++++++++++++++ 3 files changed, 287 insertions(+), 4 deletions(-) create mode 100644 tests-ui/tests/components/bottomPanel/tabs/terminal/BaseTerminal.test.ts diff --git a/src/components/bottomPanel/tabs/terminal/BaseTerminal.vue b/src/components/bottomPanel/tabs/terminal/BaseTerminal.vue index 4d921d97b..52cb75a7f 100644 --- a/src/components/bottomPanel/tabs/terminal/BaseTerminal.vue +++ b/src/components/bottomPanel/tabs/terminal/BaseTerminal.vue @@ -3,15 +3,37 @@
+