aardio 文档

string.editor 库模块帮助文档

string.editor 成员列表 #

文本编辑器
提供 replace / insertBefore / insertAfter / deleteBetween / replaceBetween / replaceLines 等文本编辑操作。
这个库主要用于 AI Agent 自动化工具调用,属于 AA(aardio autos) 代码手术刀的底层组件。

string.editor.buildChangePreview(before, after, maxBytes) #

构建首个差异区间附近的上下文预览

string.editor.charName(code) #

获取字符字节码的可读名称

string.editor.findNearestMatch(src, target) #

查找最相似的位置(用于诊断匹配失败),返回诊断 table 或 null

string.editor.lineOfIndex(text, index) #

计算给定字节索引所在行号(1-based),兼容 CRLF/LF/CR

string.editor.process() #

返回对象:stringEditorProcessResObject

string.editor.process(text, args) #

对文本执行编辑操作,返回三个值:
newText, errMsg, info

args 参数表可用字段:

string.editor.visualizeWhitespace(text, maxLen) #

可视化空白字符:SPACE→· TAB→⇥ LF→↓ CR→⇠ CRLF→↵↓ NUL→∅

stringEditorProcessResObject 成员列表 #

stringEditorProcessResObject.changePreview #

首个差异区间的上下文预览

stringEditorProcessResObject.changed #

是否发生了改变

stringEditorProcessResObject.count #

命中及编辑次数

stringEditorProcessResObject.eol #

源文本换行风格("CRLF"、"LF"、"CR" 或 null)

stringEditorProcessResObject.eolNormalized #

传入的文本换行是否被适配正常化了

stringEditorProcessResObject.originalBytes #

原始字节数

stringEditorProcessResObject.resultBytes #

结果字节数

Markdown 格式