Skip to content

Commit c4ad884

Browse files
committed
use exported consts
1 parent db9abab commit c4ad884

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

webview-ui/src/utils/command-validation.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,7 @@ export function parseCommand(command: string): string[] {
240240

241241
// First, protect newlines inside quoted strings by replacing them with placeholders
242242
// This prevents splitting multi-line quoted strings (e.g., git commit -m "multi\nline")
243-
const newlinePlaceholder = "___NEWLINE_IN_QUOTE___"
244-
const carriageReturnPlaceholder = "___CR_IN_QUOTE___"
245-
const protectedCommand = protectNewlinesInQuotes(command, newlinePlaceholder, carriageReturnPlaceholder)
243+
const protectedCommand = protectNewlinesInQuotes(command, NEWLINE_PLACEHOLDER, CARRIAGE_RETURN_PLACEHOLDER)
246244

247245
// Split by newlines (handle different line ending formats)
248246
// This regex splits on \r\n (Windows), \n (Unix), or \r (old Mac)
@@ -261,8 +259,8 @@ export function parseCommand(command: string): string[] {
261259
// Restore newlines and carriage returns in quoted strings
262260
return allCommands.map((cmd) =>
263261
cmd
264-
.replace(new RegExp(newlinePlaceholder, "g"), "\n")
265-
.replace(new RegExp(carriageReturnPlaceholder, "g"), "\r"),
262+
.replace(new RegExp(NEWLINE_PLACEHOLDER, "g"), "\n")
263+
.replace(new RegExp(CARRIAGE_RETURN_PLACEHOLDER, "g"), "\r"),
266264
)
267265
}
268266

0 commit comments

Comments
 (0)