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


TypeScript prefixSumComputer.PrefixSumComputer类代码示例

本文整理汇总了TypeScript中vs/editor/common/viewModel/prefixSumComputer.PrefixSumComputer的典型用法代码示例。如果您正苦于以下问题:TypeScript PrefixSumComputer类的具体用法?TypeScript PrefixSumComputer怎么用?TypeScript PrefixSumComputer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getRangeAt

	public getRangeAt(offset: number, length: number): Range {
		const startResult = this._lineStarts.getIndexOf(offset);
		const startLineLength = this._lines[startResult.index].length;
		const startColumn = Math.min(startResult.remainder + 1, startLineLength + 1);

		const endResult = this._lineStarts.getIndexOf(offset + length);
		const endLineLength = this._lines[endResult.index].length;
		const endColumn = Math.min(endResult.remainder + 1, endLineLength + 1);

		return new Range(startResult.index + 1, startColumn, endResult.index + 1, endColumn);
	}
开发者ID:JarnoNijboer,项目名称:vscode,代码行数:11,代码来源:linesTextBuffer.ts

示例2: _acceptDeleteRange

	private _acceptDeleteRange(range: IRange): void {

		if (range.startLineNumber === range.endLineNumber) {
			if (range.startColumn === range.endColumn) {
				// Nothing to delete
				return;
			}
			// Delete text on the affected line
			this._setLineText(range.startLineNumber - 1,
				this._lines[range.startLineNumber - 1].substring(0, range.startColumn - 1)
				+ this._lines[range.startLineNumber - 1].substring(range.endColumn - 1)
			);
			return;
		}

		// Take remaining text on last line and append it to remaining text on first line
		this._setLineText(range.startLineNumber - 1,
			this._lines[range.startLineNumber - 1].substring(0, range.startColumn - 1)
			+ this._lines[range.endLineNumber - 1].substring(range.endColumn - 1)
		);

		// Delete middle lines
		this._lines.splice(range.startLineNumber, range.endLineNumber - range.startLineNumber);
		if (this._lineStarts) {
			// update prefix sum
			this._lineStarts.removeValues(range.startLineNumber, range.endLineNumber - range.startLineNumber);
		}
	}
开发者ID:13572293130,项目名称:vscode,代码行数:28,代码来源:mirrorModel2.ts

示例3: convertInputPositionToOutputPosition

	public convertInputPositionToOutputPosition(inputLineNumber: number, inputColumn: number): editorCommon.IEditorPosition {
		this._ensureValidState();
		if (inputLineNumber > this.lines.length) {
			inputLineNumber = this.lines.length;
		}

		let lineIndex = inputLineNumber - 1, lineIndexChanged = false;
		while (lineIndex > 0 && !this.lines[lineIndex].isVisible()) {
			lineIndex--;
			lineIndexChanged = true;
		}
		if (lineIndex === 0 && !this.lines[lineIndex].isVisible()) {
			// Could not reach a real line
			return new Position(1, 1);
		}
		var deltaLineNumber = 1 + (lineIndex === 0 ? 0 : this.prefixSumComputer.getAccumulatedValue(lineIndex - 1));

		var r:editorCommon.IEditorPosition;
		if (lineIndexChanged) {
			r =  this.lines[lineIndex].getOutputPositionOfInputPosition(deltaLineNumber, this.model.getLineMaxColumn(lineIndex + 1));
		} else {
			r = this.lines[inputLineNumber - 1].getOutputPositionOfInputPosition(deltaLineNumber, inputColumn);
		}

//		console.log('in -> out ' + inputLineNumber + ',' + inputColumn + ' ===> ' + r.lineNumber + ',' + r.column);
		return r;
	}
开发者ID:pieandcakes,项目名称:vscode,代码行数:27,代码来源:splitLinesCollection.ts

示例4: convertInputPositionToOutputPosition

	public convertInputPositionToOutputPosition(_inputLineNumber: number, _inputColumn: number): Position {
		this._ensureValidState();

		let validPosition = this.model.validatePosition(new Position(_inputLineNumber, _inputColumn));
		let inputLineNumber = validPosition.lineNumber;
		let inputColumn = validPosition.column;

		let lineIndex = inputLineNumber - 1, lineIndexChanged = false;
		while (lineIndex > 0 && !this.lines[lineIndex].isVisible()) {
			lineIndex--;
			lineIndexChanged = true;
		}
		if (lineIndex === 0 && !this.lines[lineIndex].isVisible()) {
			// Could not reach a real line
			// console.log('in -> out ' + inputLineNumber + ',' + inputColumn + ' ===> ' + 1 + ',' + 1);
			return new Position(1, 1);
		}
		let deltaLineNumber = 1 + (lineIndex === 0 ? 0 : this.prefixSumComputer.getAccumulatedValue(lineIndex - 1));

		let r:Position;
		if (lineIndexChanged) {
			r =  this.lines[lineIndex].getOutputPositionOfInputPosition(deltaLineNumber, this.model.getLineMaxColumn(lineIndex + 1));
		} else {
			r = this.lines[inputLineNumber - 1].getOutputPositionOfInputPosition(deltaLineNumber, inputColumn);
		}

		// console.log('in -> out ' + inputLineNumber + ',' + inputColumn + ' ===> ' + r.lineNumber + ',' + r);
		return r;
	}
开发者ID:1Hgm,项目名称:vscode,代码行数:29,代码来源:splitLinesCollection.ts

示例5: getInputOffsetOfOutputPosition

	public getInputOffsetOfOutputPosition(outputLineIndex: number, outputOffset: number): number {
		if (outputLineIndex === 0) {
			return outputOffset;
		} else {
			return this._prefixSums.getAccumulatedValue(outputLineIndex - 1) + outputOffset;
		}
	}
开发者ID:Chan-PH,项目名称:vscode,代码行数:7,代码来源:characterHardWrappingLineMapper.ts

示例6: _setLineText

	/**
	 * All changes to a line's text go through this method
	 */
	private _setLineText(lineIndex:number, newValue:string): void {
		this._lines[lineIndex] = newValue;
		if (this._lineStarts) {
			// update prefix sum
			this._lineStarts.changeValue(lineIndex, this._lines[lineIndex].length + this._eol.length);
		}
	}
开发者ID:13572293130,项目名称:vscode,代码行数:10,代码来源:mirrorModel2.ts

示例7: getOutputLineMaxColumn

	public getOutputLineMaxColumn(outputLineNumber: number): number {
		this._ensureValidState();
		this.prefixSumComputer.getIndexOf(outputLineNumber - 1, this.tmpIndexOfResult);
		var lineIndex = this.tmpIndexOfResult.index;
		var remainder = this.tmpIndexOfResult.remainder;

		return this.lines[lineIndex].getOutputLineMaxColumn(this.model, lineIndex + 1, remainder);
	}
开发者ID:pieandcakes,项目名称:vscode,代码行数:8,代码来源:splitLinesCollection.ts

示例8: getOutputLineTokens

	public getOutputLineTokens(outputLineNumber: number, inaccurateTokensAcceptable: boolean): editorCommon.IViewLineTokens {
		this._ensureValidState();
		this.prefixSumComputer.getIndexOf(outputLineNumber - 1, this.tmpIndexOfResult);
		var lineIndex = this.tmpIndexOfResult.index;
		var remainder = this.tmpIndexOfResult.remainder;

		return this.lines[lineIndex].getOutputLineTokens(this.model, lineIndex + 1, remainder, inaccurateTokensAcceptable);
	}
开发者ID:pieandcakes,项目名称:vscode,代码行数:8,代码来源:splitLinesCollection.ts

示例9: getOutputLineTokens

	public getOutputLineTokens(outputLineNumber: number): editorCommon.ViewLineTokens {
		this._ensureValidState();
		outputLineNumber = this._toValidOutputLineNumber(outputLineNumber);
		let r = this.prefixSumComputer.getIndexOf(outputLineNumber - 1);
		let lineIndex = r.index;
		let remainder = r.remainder;

		return this.lines[lineIndex].getOutputLineTokens(this.model, lineIndex + 1, remainder);
	}
开发者ID:1833183060,项目名称:vscode,代码行数:9,代码来源:splitLinesCollection.ts

示例10: getOutputLineMaxColumn

	public getOutputLineMaxColumn(outputLineNumber: number): number {
		this._ensureValidState();
		outputLineNumber = this._toValidOutputLineNumber(outputLineNumber);
		let r = this.prefixSumComputer.getIndexOf(outputLineNumber - 1);
		let lineIndex = r.index;
		let remainder = r.remainder;

		return this.lines[lineIndex].getOutputLineMaxColumn(this.model, lineIndex + 1, remainder);
	}
开发者ID:1833183060,项目名称:vscode,代码行数:9,代码来源:splitLinesCollection.ts


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