本文整理汇总了TypeScript中vs/editor/common/model/chunksTextBuffer/bufferPiece.BufferPiece.normalizeEOL方法的典型用法代码示例。如果您正苦于以下问题:TypeScript BufferPiece.normalizeEOL方法的具体用法?TypeScript BufferPiece.normalizeEOL怎么用?TypeScript BufferPiece.normalizeEOL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/editor/common/model/chunksTextBuffer/bufferPiece.BufferPiece
的用法示例。
在下文中一共展示了BufferPiece.normalizeEOL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: setEOL
public setEOL(newEOL: '\r\n' | '\n'): void {
let leafs: BufferPiece[] = [];
for (let i = 0, len = this._leafs.length; i < len; i++) {
leafs[i] = BufferPiece.normalizeEOL(this._leafs[i], newEOL);
}
this._leafs = leafs;
this._rebuildNodes();
this._eol = newEOL;
this._eolLength = this._eol.length;
}
示例2: create
public create(defaultEOL: DefaultEndOfLine): ITextBuffer {
const eol = this._getEOL(defaultEOL);
let pieces = this._pieces;
if (
(eol === '\r\n' && (this._cr > 0 || this._lf > 0))
|| (eol === '\n' && (this._cr > 0 || this._crlf > 0))
) {
// Normalize pieces
for (let i = 0, len = pieces.length; i < len; i++) {
pieces[i] = BufferPiece.normalizeEOL(pieces[i], eol);
}
}
return new ChunksTextBuffer(pieces, this._averageChunkSize, this._BOM, eol, this._containsRTL, this._isBasicASCII);
}