mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 17:23:40 -05:00
Merge VS Code 1.21 source code (#1067)
* Initial VS Code 1.21 file copy with patches * A few more merges * Post npm install * Fix batch of build breaks * Fix more build breaks * Fix more build errors * Fix more build breaks * Runtime fixes 1 * Get connection dialog working with some todos * Fix a few packaging issues * Copy several node_modules to package build to fix loader issues * Fix breaks from master * A few more fixes * Make tests pass * First pass of license header updates * Second pass of license header updates * Fix restore dialog issues * Remove add additional themes menu items * fix select box issues where the list doesn't show up * formatting * Fix editor dispose issue * Copy over node modules to correct location on all platforms
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { ICommand, TextModelResolvedOptions, IConfiguration, IModel, ScrollType } from 'vs/editor/common/editorCommon';
|
||||
import { ICommand, IConfiguration, ScrollType } from 'vs/editor/common/editorCommon';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { Selection, ISelection } from 'vs/editor/common/core/selection';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
@@ -19,6 +19,7 @@ import { IConfigurationChangedEvent } from 'vs/editor/common/config/editorOption
|
||||
import { IViewModel } from 'vs/editor/common/viewModel/viewModel';
|
||||
import { CursorChangeReason } from 'vs/editor/common/controller/cursorEvents';
|
||||
import { VerticalRevealType } from 'vs/editor/common/view/viewEvents';
|
||||
import { TextModelResolvedOptions, ITextModel } from 'vs/editor/common/model';
|
||||
|
||||
export interface IColumnSelectData {
|
||||
toViewLineNumber: number;
|
||||
@@ -289,11 +290,11 @@ export class SingleCursorState {
|
||||
export class CursorContext {
|
||||
_cursorContextBrand: void;
|
||||
|
||||
public readonly model: IModel;
|
||||
public readonly model: ITextModel;
|
||||
public readonly viewModel: IViewModel;
|
||||
public readonly config: CursorConfiguration;
|
||||
|
||||
constructor(configuration: IConfiguration, model: IModel, viewModel: IViewModel) {
|
||||
constructor(configuration: IConfiguration, model: ITextModel, viewModel: IViewModel) {
|
||||
this.model = model;
|
||||
this.viewModel = viewModel;
|
||||
this.config = new CursorConfiguration(
|
||||
@@ -381,50 +382,6 @@ export class CursorState {
|
||||
return states;
|
||||
}
|
||||
|
||||
public static ensureInEditableRange(context: CursorContext, states: CursorState[]): CursorState[] {
|
||||
const model = context.model;
|
||||
if (!model.hasEditableRange()) {
|
||||
return states;
|
||||
}
|
||||
|
||||
const modelEditableRange = model.getEditableRange();
|
||||
const viewEditableRange = context.convertModelRangeToViewRange(modelEditableRange);
|
||||
|
||||
let result: CursorState[] = [];
|
||||
for (let i = 0, len = states.length; i < len; i++) {
|
||||
const state = states[i];
|
||||
|
||||
if (state.modelState) {
|
||||
const newModelState = CursorState._ensureInEditableRange(state.modelState, modelEditableRange);
|
||||
result[i] = newModelState ? CursorState.fromModelState(newModelState) : state;
|
||||
} else {
|
||||
const newViewState = CursorState._ensureInEditableRange(state.viewState, viewEditableRange);
|
||||
result[i] = newViewState ? CursorState.fromViewState(newViewState) : state;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static _ensureInEditableRange(state: SingleCursorState, editableRange: Range): SingleCursorState {
|
||||
const position = state.position;
|
||||
|
||||
if (position.lineNumber < editableRange.startLineNumber || (position.lineNumber === editableRange.startLineNumber && position.column < editableRange.startColumn)) {
|
||||
return new SingleCursorState(
|
||||
state.selectionStart, state.selectionStartLeftoverVisibleColumns,
|
||||
new Position(editableRange.startLineNumber, editableRange.startColumn), 0
|
||||
);
|
||||
}
|
||||
|
||||
if (position.lineNumber > editableRange.endLineNumber || (position.lineNumber === editableRange.endLineNumber && position.column > editableRange.endColumn)) {
|
||||
return new SingleCursorState(
|
||||
state.selectionStart, state.selectionStartLeftoverVisibleColumns,
|
||||
new Position(editableRange.endLineNumber, editableRange.endColumn), 0
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
readonly modelState: SingleCursorState;
|
||||
readonly viewState: SingleCursorState;
|
||||
|
||||
@@ -497,6 +454,8 @@ export class CursorColumns {
|
||||
let charCode = lineContent.charCodeAt(i);
|
||||
if (charCode === CharCode.Tab) {
|
||||
result = this.nextTabStop(result, tabSize);
|
||||
} else if (strings.isFullWidthCharacter(charCode)) {
|
||||
result = result + 2;
|
||||
} else {
|
||||
result = result + 1;
|
||||
}
|
||||
@@ -522,6 +481,8 @@ export class CursorColumns {
|
||||
let afterVisibleColumn: number;
|
||||
if (charCode === CharCode.Tab) {
|
||||
afterVisibleColumn = this.nextTabStop(beforeVisibleColumn, tabSize);
|
||||
} else if (strings.isFullWidthCharacter(charCode)) {
|
||||
afterVisibleColumn = beforeVisibleColumn + 2;
|
||||
} else {
|
||||
afterVisibleColumn = beforeVisibleColumn + 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user