本文整理匯總了TypeScript中vs/editor/common/viewLayout/whitespaceComputer.WhitespaceComputer.onLinesInserted方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript WhitespaceComputer.onLinesInserted方法的具體用法?TypeScript WhitespaceComputer.onLinesInserted怎麽用?TypeScript WhitespaceComputer.onLinesInserted使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vs/editor/common/viewLayout/whitespaceComputer.WhitespaceComputer
的用法示例。
在下文中一共展示了WhitespaceComputer.onLinesInserted方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: onLinesInserted
/**
* Notify the layouter that lines have been inserted (a continuous zone of lines).
*
* @param fromLineNumber The line number at which the insertion started, inclusive
* @param toLineNumber The line number at which the insertion ended, inclusive.
*/
public onLinesInserted(fromLineNumber: number, toLineNumber: number): void {
this._lineCount += (toLineNumber - fromLineNumber + 1);
this._whitespaces.onLinesInserted(fromLineNumber, toLineNumber);
}
示例2: test
//.........這裏部分代碼省略.........
assert.equal(whitespaceComputer.getHeightForWhitespaceIndex(3), 20);
assert.equal(whitespaceComputer.getAccumulatedHeight(0), 50);
assert.equal(whitespaceComputer.getAccumulatedHeight(1), 150);
assert.equal(whitespaceComputer.getAccumulatedHeight(2), 180);
assert.equal(whitespaceComputer.getAccumulatedHeight(3), 200);
assert.equal(whitespaceComputer.getTotalHeight(), 200);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(1), 50);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(2), 50);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(3), 150);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(4), 180);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(5), 200);
// Remove whitespace after line 2
whitespaceComputer.removeWhitespace(a);
// whitespaces: b(0, 50), d(3, 30), c(4, 20)
assert.equal(whitespaceComputer.getCount(), 3);
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(0), 0);
assert.equal(whitespaceComputer.getHeightForWhitespaceIndex(0), 50);
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(1), 3);
assert.equal(whitespaceComputer.getHeightForWhitespaceIndex(1), 30);
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(2), 4);
assert.equal(whitespaceComputer.getHeightForWhitespaceIndex(2), 20);
assert.equal(whitespaceComputer.getAccumulatedHeight(0), 50);
assert.equal(whitespaceComputer.getAccumulatedHeight(1), 80);
assert.equal(whitespaceComputer.getAccumulatedHeight(2), 100);
assert.equal(whitespaceComputer.getTotalHeight(), 100);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(1), 50);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(2), 50);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(3), 50);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(4), 80);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(5), 100);
// Remove whitespace before line 1
whitespaceComputer.removeWhitespace(b);
// whitespaces: d(3, 30), c(4, 20)
assert.equal(whitespaceComputer.getCount(), 2);
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(0), 3);
assert.equal(whitespaceComputer.getHeightForWhitespaceIndex(0), 30);
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(1), 4);
assert.equal(whitespaceComputer.getHeightForWhitespaceIndex(1), 20);
assert.equal(whitespaceComputer.getAccumulatedHeight(0), 30);
assert.equal(whitespaceComputer.getAccumulatedHeight(1), 50);
assert.equal(whitespaceComputer.getTotalHeight(), 50);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(1), 0);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(2), 0);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(3), 0);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(4), 30);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(5), 50);
// Delete line 1
whitespaceComputer.onLinesDeleted(1, 1);
// whitespaces: d(2, 30), c(3, 20)
assert.equal(whitespaceComputer.getCount(), 2);
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(0), 2);
assert.equal(whitespaceComputer.getHeightForWhitespaceIndex(0), 30);
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(1), 3);
assert.equal(whitespaceComputer.getHeightForWhitespaceIndex(1), 20);
assert.equal(whitespaceComputer.getAccumulatedHeight(0), 30);
assert.equal(whitespaceComputer.getAccumulatedHeight(1), 50);
assert.equal(whitespaceComputer.getTotalHeight(), 50);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(1), 0);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(2), 0);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(3), 30);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(4), 50);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(5), 50);
// Insert a line before line 1
whitespaceComputer.onLinesInserted(1, 1);
// whitespaces: d(3, 30), c(4, 20)
assert.equal(whitespaceComputer.getCount(), 2);
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(0), 3);
assert.equal(whitespaceComputer.getHeightForWhitespaceIndex(0), 30);
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(1), 4);
assert.equal(whitespaceComputer.getHeightForWhitespaceIndex(1), 20);
assert.equal(whitespaceComputer.getAccumulatedHeight(0), 30);
assert.equal(whitespaceComputer.getAccumulatedHeight(1), 50);
assert.equal(whitespaceComputer.getTotalHeight(), 50);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(1), 0);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(2), 0);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(3), 0);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(4), 30);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(5), 50);
// Delete line 4
whitespaceComputer.onLinesDeleted(4, 4);
// whitespaces: d(3, 30), c(3, 20)
assert.equal(whitespaceComputer.getCount(), 2);
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(0), 3);
assert.equal(whitespaceComputer.getHeightForWhitespaceIndex(0), 30);
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(1), 3);
assert.equal(whitespaceComputer.getHeightForWhitespaceIndex(1), 20);
assert.equal(whitespaceComputer.getAccumulatedHeight(0), 30);
assert.equal(whitespaceComputer.getAccumulatedHeight(1), 50);
assert.equal(whitespaceComputer.getTotalHeight(), 50);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(1), 0);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(2), 0);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(3), 0);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(4), 50);
assert.equal(whitespaceComputer.getAccumulatedHeightBeforeLineNumber(5), 50);
});