Merge from master

This commit is contained in:
Raj Musuku
2019-02-21 17:56:04 -08:00
parent 5a146e34fa
commit 666ae11639
11482 changed files with 119352 additions and 255574 deletions

View File

@@ -2,9 +2,8 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { SingleCursorState, CursorContext, CursorState } from 'vs/editor/common/controller/cursorCommon';
import { CursorContext, CursorState, SingleCursorState } from 'vs/editor/common/controller/cursorCommon';
import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import { Selection, SelectionDirection } from 'vs/editor/common/core/selection';
@@ -15,13 +14,10 @@ export class OneCursor {
public modelState: SingleCursorState;
public viewState: SingleCursorState;
private _selTrackedRange: string;
private _selTrackedRange: string | null;
private _trackSelection: boolean;
constructor(context: CursorContext) {
this.modelState = null;
this.viewState = null;
this._selTrackedRange = null;
this._trackSelection = true;
@@ -63,7 +59,7 @@ export class OneCursor {
}
public readSelectionFromMarkers(context: CursorContext): Selection {
const range = context.model._getTrackedRange(this._selTrackedRange);
const range = context.model._getTrackedRange(this._selTrackedRange!)!;
if (this.modelState.selection.getDirection() === SelectionDirection.LTR) {
return new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);
}
@@ -74,12 +70,15 @@ export class OneCursor {
this._setState(context, this.modelState, this.viewState);
}
public setState(context: CursorContext, modelState: SingleCursorState, viewState: SingleCursorState): void {
public setState(context: CursorContext, modelState: SingleCursorState | null, viewState: SingleCursorState | null): void {
this._setState(context, modelState, viewState);
}
private _setState(context: CursorContext, modelState: SingleCursorState, viewState: SingleCursorState): void {
private _setState(context: CursorContext, modelState: SingleCursorState | null, viewState: SingleCursorState | null): void {
if (!modelState) {
if (!viewState) {
return;
}
// We only have the view state => compute the model state
const selectionStart = context.model.validateRange(
context.convertViewRangeToModelRange(viewState.selectionStart)