fix(coding-agent): corrected variable initialization order in formatPromptContent
- Corrected variable initialization order in formatPromptContent to prevent stale trimmedStart value when ASCII symbol replacement occurs. - Updated bash.md documentation to use ellipsis (...) instead of three dots (...) for consistency with ASCII symbol replacement behavior. - Added test case verifying table row compaction and content deduplication during pre-render with ASCII symbol replacement.
This commit is contained in:
@@ -86,9 +86,7 @@ export function formatPromptContent(content: string, options: PromptFormatOption
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
let line = lines[i].trimEnd();
|
||||
const trimmed = line.trim();
|
||||
const trimmedStart = line.trimStart();
|
||||
|
||||
let trimmedStart = line.trimStart();
|
||||
if (CODE_FENCE.test(trimmedStart)) {
|
||||
inCodeBlock = !inCodeBlock;
|
||||
result.push(line);
|
||||
@@ -103,6 +101,8 @@ export function formatPromptContent(content: string, options: PromptFormatOption
|
||||
if (replaceAsciiSymbols) {
|
||||
line = replaceCommonAsciiSymbols(line);
|
||||
}
|
||||
trimmedStart = line.trimStart();
|
||||
const trimmed = line.trim();
|
||||
|
||||
const isOpeningXml = OPENING_XML.test(trimmedStart) && !trimmedStart.endsWith("/>");
|
||||
if (isOpeningXml && line.length === trimmedStart.length) {
|
||||
|
||||
Reference in New Issue
Block a user