• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript prefixSumComputer.PrefixSumComputer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap