當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。