Skip to content

Commit 607b9f2

Browse files
committed
fix:修正插入操作
1 parent 396ff8e commit 607b9f2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

prompt/testdata.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ import { registerCvbContextMenu } from './siderBar';
121121
```
122122
## AFTER_ANCHOR
123123
```typescript
124-
import { GuidePage } from './guidePage';
124+
let currentOperationController: AbortController | null = null;
125125
```
126126
## INSERT_CONTENT
127127
```typescript

src/cvbManager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ TCVB 格式规范:
525525
1. 文件路径复用:同一文件下## FILE ,可以有多个## OPERATION,不用每次重复相同的## FILE
526526
2. 锚点为连续的多行内容:使用至少3行唯一文本作为锚点,用来标定范围,防止混淆
527527
3. 代码块,(规则中的[代码块:...]) 用 markdown 格式包裹
528+
4. 注意,所有的OPERATION操作都是以行为单位的
528529
`;
529530
}
530531
}
@@ -596,7 +597,7 @@ function applyGlobalReplace(strContent: string, op: GlobalReplaceOperation) : st
596597

597598
function applyInsert(strContent: string, op: InsertOperation) : string
598599
{
599-
const regPattern: RegExp = buildPattern(op.m_strBeforeAnchor, '', op.m_strAfterAnchor);
600+
const regPattern: RegExp = buildPattern(op.m_strBeforeAnchor, "((?:[ \\t]*(?:\\r?\\n))*)" , op.m_strAfterAnchor);
600601
const strReplacement: string = op.m_strBeforeAnchor + op.m_strInsertContent + op.m_strAfterAnchor;
601602
return strContent.replace(regPattern, strReplacement);
602603
}

0 commit comments

Comments
 (0)