本文整理汇总了TypeScript中vs/editor/common/core/selection.Selection.createSelection方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Selection.createSelection方法的具体用法?TypeScript Selection.createSelection怎么用?TypeScript Selection.createSelection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/editor/common/core/selection.Selection
的用法示例。
在下文中一共展示了Selection.createSelection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('Get selected changes test - one change partially seleceted with multiple selections', () => {
var selections: Selection[] = [];
selections.push(Selection.createSelection(2, 2, 5, 5), Selection.createSelection(7, 2, 9, 1));
var changes: IChange[] = [];
changes.push(createChange(1, 15, 1, 10), createChange(120, 127, 122, 126));
var result = getSelectedChanges(changes, selections);
var expected: IChange[] = [];
expected.push(createChange(2, 5, 1, 10), createChange(7, 9, 1, 10));
changesEqual(result, expected);
});
示例2: computeCursorState
public computeCursorState(model:editorCommon.ITokenizedModel, helper: editorCommon.ICursorStateComputerData): Selection {
var inverseEditOperations = helper.getInverseEditOperations();
var srcRange = inverseEditOperations[inverseEditOperations.length - 1].range;
return Selection.createSelection(
srcRange.endLineNumber,
srcRange.endColumn,
srcRange.endLineNumber,
srcRange.endColumn
);
}
示例3: computeCursorState
public computeCursorState(model:EditorCommon.ITokenizedModel, helper: EditorCommon.ICursorStateComputerData):EditorCommon.IEditorSelection {
var inverseEditOperations = helper.getInverseEditOperations();
var srcRange = inverseEditOperations[0].range;
return Selection.createSelection(
srcRange.endLineNumber,
this.restoreCursorToColumn,
srcRange.endLineNumber,
this.restoreCursorToColumn
);
}
示例4: computeCursorState
public computeCursorState(model:editorCommon.ITokenizedModel, helper: editorCommon.ICursorStateComputerData):Selection {
var inverseEditOperations = helper.getInverseEditOperations();
var srcRange = inverseEditOperations[0].range;
if (!this._originalSelection.isEmpty()) {
// Preserve selection and extends to typed text
return Selection.createSelection(
srcRange.endLineNumber,
srcRange.endColumn - this._text.length,
srcRange.endLineNumber,
srcRange.endColumn
);
}
return Selection.createSelection(
srcRange.endLineNumber,
Math.min(this._originalSelection.positionColumn, srcRange.endColumn),
srcRange.endLineNumber,
Math.min(this._originalSelection.positionColumn, srcRange.endColumn)
);
}