本文整理汇总了TypeScript中vs/editor/common/viewLayout/verticalObjects.VerticalObjects.onModelLinesInserted方法的典型用法代码示例。如果您正苦于以下问题:TypeScript VerticalObjects.onModelLinesInserted方法的具体用法?TypeScript VerticalObjects.onModelLinesInserted怎么用?TypeScript VerticalObjects.onModelLinesInserted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/editor/common/viewLayout/verticalObjects.VerticalObjects
的用法示例。
在下文中一共展示了VerticalObjects.onModelLinesInserted方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: onModelLinesInserted
/**
* Event handler, call when the model has had lines inserted.
*/
public onModelLinesInserted(e:editorCommon.IViewLinesInsertedEvent): void {
this.verticalObjects.onModelLinesInserted(e.fromLineNumber, e.toLineNumber);
}
示例2: test
test('VerticalObjects 2', () => {
var verticalObjects = new VerticalObjects();
// Start off with 10 lines and one whitespace after line 2, of height 5
verticalObjects.replaceLines(10);
var a = verticalObjects.insertWhitespace(2, 0, 5);
// 10 lines
// whitespace: - a(2,5)
assert.equal(verticalObjects.getTotalHeight(1), 15);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(1, 1), 0);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(2, 1), 1);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(3, 1), 7);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(4, 1), 8);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(5, 1), 9);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(6, 1), 10);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(7, 1), 11);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(8, 1), 12);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(9, 1), 13);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(10, 1), 14);
// Change whitespace height
// 10 lines
// whitespace: - a(2,10)
verticalObjects.changeWhitespace(a, 2, 10);
assert.equal(verticalObjects.getTotalHeight(1), 20);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(1, 1), 0);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(2, 1), 1);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(3, 1), 12);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(4, 1), 13);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(5, 1), 14);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(6, 1), 15);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(7, 1), 16);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(8, 1), 17);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(9, 1), 18);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(10, 1), 19);
// Change whitespace position
// 10 lines
// whitespace: - a(5,10)
verticalObjects.changeWhitespace(a, 5, 10);
assert.equal(verticalObjects.getTotalHeight(1), 20);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(1, 1), 0);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(2, 1), 1);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(3, 1), 2);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(4, 1), 3);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(5, 1), 4);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(6, 1), 15);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(7, 1), 16);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(8, 1), 17);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(9, 1), 18);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(10, 1), 19);
// Pretend that lines 5 and 6 were deleted
// 8 lines
// whitespace: - a(4,10)
verticalObjects.onModelLinesDeleted(5, 6);
assert.equal(verticalObjects.getTotalHeight(1), 18);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(1, 1), 0);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(2, 1), 1);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(3, 1), 2);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(4, 1), 3);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(5, 1), 14);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(6, 1), 15);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(7, 1), 16);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(8, 1), 17);
// Insert two lines at the beginning
// 10 lines
// whitespace: - a(6,10)
verticalObjects.onModelLinesInserted(1, 2);
assert.equal(verticalObjects.getTotalHeight(1), 20);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(1, 1), 0);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(2, 1), 1);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(3, 1), 2);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(4, 1), 3);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(5, 1), 4);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(6, 1), 5);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(7, 1), 16);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(8, 1), 17);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(9, 1), 18);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(10, 1), 19);
// Remove whitespace
// 10 lines
verticalObjects.removeWhitespace(a);
assert.equal(verticalObjects.getTotalHeight(1), 10);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(1, 1), 0);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(2, 1), 1);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(3, 1), 2);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(4, 1), 3);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(5, 1), 4);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(6, 1), 5);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(7, 1), 6);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(8, 1), 7);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(9, 1), 8);
assert.equal(verticalObjects.getVerticalOffsetForLineNumber(10, 1), 9);
});