Increase paste timeout + add warning. (#13099)

This commit is contained in:
Tommaso Sciortino
2025-11-14 16:02:28 -08:00
committed by GitHub
parent ab6b2293e1
commit d03496b710
5 changed files with 29 additions and 13 deletions

View File

@@ -18,10 +18,11 @@ import {
import { ESC } from '../utils/input.js';
import { parseMouseEvent } from '../utils/mouse.js';
import { FOCUS_IN, FOCUS_OUT } from '../hooks/useFocus.js';
import { appEvents, AppEvent } from '../../utils/events.js';
export const BACKSLASH_ENTER_TIMEOUT = 5;
export const ESC_TIMEOUT = 50;
export const PASTE_TIMEOUT = 50;
export const PASTE_TIMEOUT = 30_000;
// Parse the key itself
const KEY_INFO_MAP: Record<
@@ -211,7 +212,12 @@ function bufferPaste(
key = yield;
clearTimeout(timeoutId);
if (key === null || key.name === 'paste-end') {
if (key === null) {
appEvents.emit(AppEvent.PasteTimeout);
break;
}
if (key.name === 'paste-end') {
break;
}
buffer += key.sequence;

View File

@@ -125,7 +125,7 @@ export interface UIState {
showDebugProfiler: boolean;
showFullTodos: boolean;
copyModeEnabled: boolean;
selectionWarning: boolean;
warningMessage: string | null;
}
export const UIStateContext = createContext<UIState | null>(null);