summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/utils/platformConstants.ts
diff options
context:
space:
mode:
authorDeepankar Sharma <[email protected]>2025-08-13 13:32:54 -0400
committerGitHub <[email protected]>2025-08-13 17:32:54 +0000
commit9c7fb870c1a7c80741fafdfc6837d4b92e373b2d (patch)
tree1e31f201520c9724b4659ee7a36c21215e6280b9 /packages/cli/src/ui/utils/platformConstants.ts
parent74a13fb535b255797d6c9aa3499acfea6aadc58d (diff)
Add terminal setup command for Shift+Enter and Ctrl+Enter support (#3289)
Co-authored-by: jacob314 <[email protected]>
Diffstat (limited to 'packages/cli/src/ui/utils/platformConstants.ts')
-rw-r--r--packages/cli/src/ui/utils/platformConstants.ts44
1 files changed, 44 insertions, 0 deletions
diff --git a/packages/cli/src/ui/utils/platformConstants.ts b/packages/cli/src/ui/utils/platformConstants.ts
new file mode 100644
index 00000000..9d2e1990
--- /dev/null
+++ b/packages/cli/src/ui/utils/platformConstants.ts
@@ -0,0 +1,44 @@
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/**
+ * Terminal Platform Constants
+ *
+ * This file contains terminal-related constants used throughout the application,
+ * specifically for handling keyboard inputs and terminal protocols.
+ */
+
+/**
+ * Kitty keyboard protocol sequences for enhanced keyboard input.
+ * @see https://sw.kovidgoyal.net/kitty/keyboard-protocol/
+ */
+export const KITTY_CTRL_C = '[99;5u';
+
+/**
+ * Timing constants for terminal interactions
+ */
+export const CTRL_EXIT_PROMPT_DURATION_MS = 1000;
+
+/**
+ * VS Code terminal integration constants
+ */
+export const VSCODE_SHIFT_ENTER_SEQUENCE = '\\\r\n';
+
+/**
+ * Backslash + Enter detection window in milliseconds.
+ * Used to detect Shift+Enter pattern where backslash
+ * is followed by Enter within this timeframe.
+ */
+export const BACKSLASH_ENTER_DETECTION_WINDOW_MS = 5;
+
+/**
+ * Maximum expected length of a Kitty keyboard protocol sequence.
+ * Format: ESC [ <keycode> ; <modifiers> u/~
+ * Example: \x1b[13;2u (Shift+Enter) = 8 chars
+ * Longest reasonable: \x1b[127;15~ = 11 chars (Del with all modifiers)
+ * We use 12 to provide a small buffer.
+ */
+export const MAX_KITTY_SEQUENCE_LENGTH = 12;