MCPcopy
hub / github.com/codeaashu/claude-code / showCopiedToast

Function showCopiedToast

src/components/ScrollKeybindingHandler.tsx:373–398  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

371 // would read getWheelBase() before the probe reply arrives over SSH.
372 const wheelAccel = useRef<WheelAccelState | null>(null);
373 function showCopiedToast(text: string): void {
374 // getClipboardPath reads env synchronously — predicts what setClipboard
375 // did (native pbcopy / tmux load-buffer / raw OSC 52) so we can tell
376 // the user whether paste will Just Work or needs prefix+].
377 const path = getClipboardPath();
378 const n = text.length;
379 let msg: string;
380 switch (path) {
381 case 'native':
382 msg = `copied ${n} chars to clipboard`;
383 break;
384 case 'tmux-buffer':
385 msg = `copied ${n} chars to tmux buffer · paste with prefix + ]`;
386 break;
387 case 'osc52':
388 msg = `sent ${n} chars via OSC 52 · check terminal clipboard settings if paste fails`;
389 break;
390 }
391 addNotification({
392 key: 'selection-copied',
393 text: msg,
394 color: 'suggestion',
395 priority: 'immediate',
396 timeoutMs: path === 'native' ? 2000 : 4000
397 });
398 }
399 function copyAndToast(): void {
400 const text_0 = selection.copySelection();
401 if (text_0) showCopiedToast(text_0);

Callers 1

copyAndToastFunction · 0.85

Calls 1

getClipboardPathFunction · 0.85

Tested by

no test coverage detected