本文整理汇总了TypeScript中vs/editor/common/controller/cursorCommon.ICursorSimpleModel.getLineMinColumn方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ICursorSimpleModel.getLineMinColumn方法的具体用法?TypeScript ICursorSimpleModel.getLineMinColumn怎么用?TypeScript ICursorSimpleModel.getLineMinColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/editor/common/controller/cursorCommon.ICursorSimpleModel
的用法示例。
在下文中一共展示了ICursorSimpleModel.getLineMinColumn方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: paste
public static paste(config: CursorConfiguration, model: ICursorSimpleModel, cursor: SingleCursorState, text: string, pasteOnNewLine: boolean): EditOperationResult {
let position = cursor.position;
let selection = cursor.selection;
if (pasteOnNewLine && text.indexOf('\n') !== text.length - 1) {
pasteOnNewLine = false;
}
if (pasteOnNewLine && selection.startLineNumber !== selection.endLineNumber) {
pasteOnNewLine = false;
}
if (pasteOnNewLine && selection.startColumn === model.getLineMinColumn(selection.startLineNumber) && selection.endColumn === model.getLineMaxColumn(selection.startLineNumber)) {
pasteOnNewLine = false;
}
if (pasteOnNewLine) {
// Paste entire line at the beginning of line
let typeSelection = new Range(position.lineNumber, 1, position.lineNumber, 1);
return new EditOperationResult(new ReplaceCommand(typeSelection, text), {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: true,
cursorPositionChangeReason: CursorChangeReason.Paste
});
}
return new EditOperationResult(new ReplaceCommand(selection, text), {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: true,
cursorPositionChangeReason: CursorChangeReason.Paste
});
}
示例2: _simplePaste
private static _simplePaste(config: CursorConfiguration, model: ICursorSimpleModel, selections: Selection[], text: string, pasteOnNewLine: boolean): EditOperationResult {
let commands: ICommand[] = [];
for (let i = 0, len = selections.length; i < len; i++) {
const selection = selections[i];
let position = selection.getPosition();
if (pasteOnNewLine && text.indexOf('\n') !== text.length - 1) {
pasteOnNewLine = false;
}
if (pasteOnNewLine && selection.startLineNumber !== selection.endLineNumber) {
pasteOnNewLine = false;
}
if (pasteOnNewLine && selection.startColumn === model.getLineMinColumn(selection.startLineNumber) && selection.endColumn === model.getLineMaxColumn(selection.startLineNumber)) {
pasteOnNewLine = false;
}
if (pasteOnNewLine) {
// Paste entire line at the beginning of line
let typeSelection = new Range(position.lineNumber, 1, position.lineNumber, 1);
commands[i] = new ReplaceCommand(typeSelection, text);
} else {
commands[i] = new ReplaceCommand(selection, text);
}
}
return new EditOperationResult(EditOperationType.Other, commands, {
shouldPushStackElementBefore: true,
shouldPushStackElementAfter: true
});
}
示例3: up
public static up(config: CursorConfiguration, model: ICursorSimpleModel, lineNumber: number, column: number, leftoverVisibleColumns: number, count: number, allowMoveOnFirstLine: boolean): CursorPosition {
const currentVisibleColumn = CursorColumns.visibleColumnFromColumn(model.getLineContent(lineNumber), column, config.tabSize) + leftoverVisibleColumns;
lineNumber = lineNumber - count;
if (lineNumber < 1) {
lineNumber = 1;
if (allowMoveOnFirstLine) {
column = model.getLineMinColumn(lineNumber);
} else {
column = Math.min(model.getLineMaxColumn(lineNumber), column);
if (CursorColumns.isInsideSurrogatePair(model, lineNumber, column)) {
column = column - 1;
}
}
} else {
column = CursorColumns.columnFromVisibleColumn2(config, model, lineNumber, currentVisibleColumn);
if (CursorColumns.isInsideSurrogatePair(model, lineNumber, column)) {
column = column - 1;
}
}
leftoverVisibleColumns = currentVisibleColumn - CursorColumns.visibleColumnFromColumn(model.getLineContent(lineNumber), column, config.tabSize);
return new CursorPosition(lineNumber, column, leftoverVisibleColumns);
}
示例4: _lastLineNumberInRange
/**
* Find the nth line start included in the range (from the end).
*/
private static _lastLineNumberInRange(model: ICursorSimpleModel, range: Range, count: number): number {
let startLineNumber = range.startLineNumber;
if (range.startColumn !== model.getLineMinColumn(startLineNumber)) {
// Move on to the second line if the first line start is not included in the range
startLineNumber++;
}
return Math.max(startLineNumber, range.endLineNumber - count + 1);
}
示例5: getColumnAtBeginningOfLine
public static getColumnAtBeginningOfLine(model: ICursorSimpleModel, lineNumber: number, column: number): number {
var firstNonBlankColumn = model.getLineFirstNonWhitespaceColumn(lineNumber) || 1;
var minColumn = model.getLineMinColumn(lineNumber);
if (column !== minColumn && column <= firstNonBlankColumn) {
column = minColumn;
} else {
column = firstNonBlankColumn;
}
return column;
}
示例6: moveToBeginningOfLine
public static moveToBeginningOfLine(config: CursorConfiguration, model: ICursorSimpleModel, cursor: SingleCursorState, inSelectionMode: boolean): SingleMoveOperationResult {
let lineNumber = cursor.selection.startLineNumber;
let minColumn = model.getLineMinColumn(lineNumber);
let firstNonBlankColumn = model.getLineFirstNonWhitespaceColumn(lineNumber) || minColumn;
let column: number;
if (cursor.selection.startColumn === firstNonBlankColumn) {
column = minColumn;
} else {
column = firstNonBlankColumn;
}
return SingleMoveOperationResult.fromMove(cursor, inSelectionMode, lineNumber, column, 0, true, CursorChangeReason.Explicit);
}
示例7: right
public static right(config: CursorConfiguration, model: ICursorSimpleModel, lineNumber: number, column: number): CursorPosition {
if (column < model.getLineMaxColumn(lineNumber)) {
if (CursorColumns.isHighSurrogate(model, lineNumber, column - 1)) {
// character after column is a high surrogate
column = column + 2;
} else {
column = column + 1;
}
} else if (lineNumber < model.getLineCount()) {
lineNumber = lineNumber + 1;
column = model.getLineMinColumn(lineNumber);
}
return new CursorPosition(lineNumber, column, 0);
}
示例8: left
public static left(config: CursorConfiguration, model: ICursorSimpleModel, lineNumber: number, column: number): CursorPosition {
if (column > model.getLineMinColumn(lineNumber)) {
if (CursorColumns.isLowSurrogate(model, lineNumber, column - 2)) {
// character before column is a low surrogate
column = column - 2;
} else {
column = column - 1;
}
} else if (lineNumber > 1) {
lineNumber = lineNumber - 1;
column = model.getLineMaxColumn(lineNumber);
}
return new CursorPosition(lineNumber, column, 0);
}
示例9: moveToBeginningOfLine
public static moveToBeginningOfLine(config: CursorConfiguration, model: ICursorSimpleModel, cursor: SingleCursorState, inSelectionMode: boolean): SingleCursorState {
let lineNumber = cursor.position.lineNumber;
let minColumn = model.getLineMinColumn(lineNumber);
let firstNonBlankColumn = model.getLineFirstNonWhitespaceColumn(lineNumber) || minColumn;
let column: number;
let relevantColumnNumber = cursor.position.column;
if (relevantColumnNumber === firstNonBlankColumn) {
column = minColumn;
} else {
column = firstNonBlankColumn;
}
return cursor.move(inSelectionMode, lineNumber, column, 0);
}