当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript CursorColumns.nextTabStop方法代码示例

本文整理汇总了TypeScript中vs/editor/common/controller/cursorCommon.CursorColumns.nextTabStop方法的典型用法代码示例。如果您正苦于以下问题:TypeScript CursorColumns.nextTabStop方法的具体用法?TypeScript CursorColumns.nextTabStop怎么用?TypeScript CursorColumns.nextTabStop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vs/editor/common/controller/cursorCommon.CursorColumns的用法示例。


在下文中一共展示了CursorColumns.nextTabStop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: shiftIndentCount

	public static shiftIndentCount(line: string, column: number, tabSize: number): number {
		// Determine the visible column where the content starts
		let contentStartVisibleColumn = CursorColumns.visibleColumnFromColumn(line, column, tabSize);

		let desiredTabStop = CursorColumns.nextTabStop(contentStartVisibleColumn, tabSize);

		// The `desiredTabStop` is a multiple of `tabSize` => determine the number of indents
		return desiredTabStop / tabSize;
	}
开发者ID:SeanKilleen,项目名称:vscode,代码行数:9,代码来源:shiftCommand.ts

示例2: test

	test('nextTabStop', () => {
		assert.equal(CursorColumns.nextTabStop(0, 4), 4);
		assert.equal(CursorColumns.nextTabStop(1, 4), 4);
		assert.equal(CursorColumns.nextTabStop(2, 4), 4);
		assert.equal(CursorColumns.nextTabStop(3, 4), 4);
		assert.equal(CursorColumns.nextTabStop(4, 4), 8);
		assert.equal(CursorColumns.nextTabStop(5, 4), 8);
		assert.equal(CursorColumns.nextTabStop(6, 4), 8);
		assert.equal(CursorColumns.nextTabStop(7, 4), 8);
		assert.equal(CursorColumns.nextTabStop(8, 4), 12);

		assert.equal(CursorColumns.nextTabStop(0, 2), 2);
		assert.equal(CursorColumns.nextTabStop(1, 2), 2);
		assert.equal(CursorColumns.nextTabStop(2, 2), 4);
		assert.equal(CursorColumns.nextTabStop(3, 2), 4);
		assert.equal(CursorColumns.nextTabStop(4, 2), 6);
		assert.equal(CursorColumns.nextTabStop(5, 2), 6);
		assert.equal(CursorColumns.nextTabStop(6, 2), 8);
		assert.equal(CursorColumns.nextTabStop(7, 2), 8);
		assert.equal(CursorColumns.nextTabStop(8, 2), 10);

		assert.equal(CursorColumns.nextTabStop(0, 1), 1);
		assert.equal(CursorColumns.nextTabStop(1, 1), 2);
		assert.equal(CursorColumns.nextTabStop(2, 1), 3);
		assert.equal(CursorColumns.nextTabStop(3, 1), 4);
		assert.equal(CursorColumns.nextTabStop(4, 1), 5);
		assert.equal(CursorColumns.nextTabStop(5, 1), 6);
		assert.equal(CursorColumns.nextTabStop(6, 1), 7);
		assert.equal(CursorColumns.nextTabStop(7, 1), 8);
		assert.equal(CursorColumns.nextTabStop(8, 1), 9);
	});
开发者ID:DonJayamanne,项目名称:vscode,代码行数:31,代码来源:cursorMoveHelper.test.ts


注:本文中的vs/editor/common/controller/cursorCommon.CursorColumns.nextTabStop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。