From 5adfb455e2e88e38fde86118e2818fdf6b294a66 Mon Sep 17 00:00:00 2001 From: Billy <814536088@qq.com> Date: Mon, 4 May 2026 00:43:26 +0800 Subject: [PATCH] feat: improve line prefix display with box drawing character --- src/tools/FileEditTool/prompt.ts | 2 +- src/utils/file.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/FileEditTool/prompt.ts b/src/tools/FileEditTool/prompt.ts index 5a4d93ad..59619c63 100644 --- a/src/tools/FileEditTool/prompt.ts +++ b/src/tools/FileEditTool/prompt.ts @@ -11,7 +11,7 @@ export function getEditToolDescription(): string { function getDefaultEditDescription(): string { const prefixFormat = isCompactLinePrefixEnabled() - ? 'line number + tab' + ? 'line number + │ (box drawing character)' : 'spaces + line number + arrow' const minimalUniquenessHint = process.env.USER_TYPE === 'ant' diff --git a/src/utils/file.ts b/src/utils/file.ts index 773c3f41..0c0a03aa 100644 --- a/src/utils/file.ts +++ b/src/utils/file.ts @@ -303,7 +303,7 @@ export function addLineNumbers({ if (isCompactLinePrefixEnabled()) { return lines - .map((line, index) => `${index + startLine}\t${line}`) + .map((line, index) => `${index + startLine}│${line}`) .join('\n') } @@ -319,11 +319,11 @@ export function addLineNumbers({ } /** - * Inverse of addLineNumbers — strips the `N→` or `N\t` prefix from a single + * Inverse of addLineNumbers — strips the `N→`, `N│` or `N\t` prefix from a single * line. Co-located so format changes here and in addLineNumbers stay in sync. */ export function stripLineNumberPrefix(line: string): string { - const match = line.match(/^\s*\d+[\u2192\t](.*)$/) + const match = line.match(/^\s*\d+[\u2192\u2502\t](.*)$/) return match?.[1] ?? line }