mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-19 13:33:35 +08:00
feat: improve line prefix display with box drawing character
This commit is contained in:
parent
1becbe36a1
commit
5adfb455e2
@ -11,7 +11,7 @@ export function getEditToolDescription(): string {
|
|||||||
|
|
||||||
function getDefaultEditDescription(): string {
|
function getDefaultEditDescription(): string {
|
||||||
const prefixFormat = isCompactLinePrefixEnabled()
|
const prefixFormat = isCompactLinePrefixEnabled()
|
||||||
? 'line number + tab'
|
? 'line number + │ (box drawing character)'
|
||||||
: 'spaces + line number + arrow'
|
: 'spaces + line number + arrow'
|
||||||
const minimalUniquenessHint =
|
const minimalUniquenessHint =
|
||||||
process.env.USER_TYPE === 'ant'
|
process.env.USER_TYPE === 'ant'
|
||||||
|
|||||||
@ -303,7 +303,7 @@ export function addLineNumbers({
|
|||||||
|
|
||||||
if (isCompactLinePrefixEnabled()) {
|
if (isCompactLinePrefixEnabled()) {
|
||||||
return lines
|
return lines
|
||||||
.map((line, index) => `${index + startLine}\t${line}`)
|
.map((line, index) => `${index + startLine}│${line}`)
|
||||||
.join('\n')
|
.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.
|
* line. Co-located so format changes here and in addLineNumbers stay in sync.
|
||||||
*/
|
*/
|
||||||
export function stripLineNumberPrefix(line: string): string {
|
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
|
return match?.[1] ?? line
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user