提交 386f9929 编写于 作者: A Alex Dima

Extract delete word commands outside of core

上级 20f903c0
......@@ -602,14 +602,6 @@ registerCommand(new CoreCommand({
}
}));
registerCommand(new WordCommand(H.DeleteWordLeft, false, KeyCode.Backspace, EditorContextKeys.Writable));
registerCommand(new UnboundCoreCommand(H.DeleteWordStartLeft, EditorContextKeys.Writable));
registerCommand(new UnboundCoreCommand(H.DeleteWordEndLeft, EditorContextKeys.Writable));
registerCommand(new WordCommand(H.DeleteWordRight, false, KeyCode.Delete, EditorContextKeys.Writable));
registerCommand(new UnboundCoreCommand(H.DeleteWordStartRight, EditorContextKeys.Writable));
registerCommand(new UnboundCoreCommand(H.DeleteWordEndRight, EditorContextKeys.Writable));
registerCommand(new CoreCommand({
id: H.CancelSelection,
precondition: EditorContextKeys.HasNonEmptySelection,
......
......@@ -18,7 +18,6 @@ import { Selection, SelectionDirection } from 'vs/editor/common/core/selection';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { CursorColumns, EditOperationResult } from 'vs/editor/common/controller/cursorCommon';
import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageConfigurationRegistry';
import { WordOperations, WordNavigationType } from 'vs/editor/common/controller/cursorWordOperations';
import { ColumnSelection, IColumnSelectResult } from 'vs/editor/common/controller/cursorColumnSelection';
import { DeleteOperations } from 'vs/editor/common/controller/cursorDeleteOperations';
import { TypeOperations } from 'vs/editor/common/controller/cursorTypeOperations';
......@@ -957,17 +956,8 @@ export class Cursor extends EventEmitter {
this._handlers[H.ScrollPageDown] = (ctx) => this._scrollDown(true, ctx);
this._handlers[H.DeleteLeft] = (ctx) => this._deleteLeft(ctx);
this._handlers[H.DeleteWordLeft] = (ctx) => this._deleteWordLeft(true, WordNavigationType.WordStart, ctx);
this._handlers[H.DeleteWordStartLeft] = (ctx) => this._deleteWordLeft(false, WordNavigationType.WordStart, ctx);
this._handlers[H.DeleteWordEndLeft] = (ctx) => this._deleteWordLeft(false, WordNavigationType.WordEnd, ctx);
this._handlers[H.DeleteRight] = (ctx) => this._deleteRight(ctx);
this._handlers[H.DeleteWordRight] = (ctx) => this._deleteWordRight(true, WordNavigationType.WordEnd, ctx);
this._handlers[H.DeleteWordStartRight] = (ctx) => this._deleteWordRight(false, WordNavigationType.WordStart, ctx);
this._handlers[H.DeleteWordEndRight] = (ctx) => this._deleteWordRight(false, WordNavigationType.WordEnd, ctx);
this._handlers[H.Cut] = (ctx) => this._cut(ctx);
this._handlers[H.ExpandLineSelection] = (ctx) => this._expandLineSelection(ctx);
......@@ -1462,18 +1452,10 @@ export class Cursor extends EventEmitter {
return this._applyEditForAll(ctx, (cursor) => DeleteOperations.deleteLeft(cursor.config, cursor.model, cursor.modelState));
}
private _deleteWordLeft(whitespaceHeuristics: boolean, wordNavigationType: WordNavigationType, ctx: IMultipleCursorOperationContext): boolean {
return this._applyEditForAll(ctx, (cursor) => WordOperations.deleteWordLeft(cursor.config, cursor.model, cursor.modelState, whitespaceHeuristics, wordNavigationType));
}
private _deleteRight(ctx: IMultipleCursorOperationContext): boolean {
return this._applyEditForAll(ctx, (cursor) => DeleteOperations.deleteRight(cursor.config, cursor.model, cursor.modelState));
}
private _deleteWordRight(whitespaceHeuristics: boolean, wordNavigationType: WordNavigationType, ctx: IMultipleCursorOperationContext): boolean {
return this._applyEditForAll(ctx, (cursor) => WordOperations.deleteWordRight(cursor.config, cursor.model, cursor.modelState, whitespaceHeuristics, wordNavigationType));
}
private _cut(ctx: IMultipleCursorOperationContext): boolean {
return this._applyEditForAll(ctx, (cursor) => DeleteOperations.cut(cursor.config, cursor.model, cursor.modelState, this.enableEmptySelectionClipboard));
}
......
......@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import { SingleCursorState, EditOperationResult, CursorConfiguration, ICursorSimpleModel } from 'vs/editor/common/controller/cursorCommon';
import { SingleCursorState, CursorConfiguration, ICursorSimpleModel } from 'vs/editor/common/controller/cursorCommon';
import { Position } from 'vs/editor/common/core/position';
import { CharCode } from 'vs/base/common/charCode';
import { CharacterClassifier } from 'vs/editor/common/core/characterClassifier';
......@@ -13,7 +13,6 @@ import { CursorChangeReason } from 'vs/editor/common/editorCommon';
import * as strings from 'vs/base/common/strings';
import { Range } from 'vs/editor/common/core/range';
import { Selection } from 'vs/editor/common/core/selection';
import { ReplaceCommand } from 'vs/editor/common/commands/replaceCommand';
export interface IFindWordResult {
/**
......@@ -268,7 +267,7 @@ export class WordOperations {
return null;
}
private static _deleteWordLeft(wordSeparators: WordCharacterClassifier, model: ICursorSimpleModel, selection: Selection, whitespaceHeuristics: boolean, wordNavigationType: WordNavigationType): Range {
public static _deleteWordLeft(wordSeparators: WordCharacterClassifier, model: ICursorSimpleModel, selection: Selection, whitespaceHeuristics: boolean, wordNavigationType: WordNavigationType): Range {
if (!selection.isEmpty()) {
return selection;
}
......@@ -332,18 +331,6 @@ export class WordOperations {
return new Range(lineNumber, column, position.lineNumber, position.column);
}
public static deleteWordLeft(config: CursorConfiguration, model: ICursorSimpleModel, cursor: SingleCursorState, whitespaceHeuristics: boolean, wordNavigationType: WordNavigationType): EditOperationResult {
const wordSeparators = getMapForWordSeparators(config.wordSeparators);
const deleteRange = this._deleteWordLeft(wordSeparators, model, cursor.selection, whitespaceHeuristics, wordNavigationType);
if (!deleteRange) {
return null;
}
return new EditOperationResult(new ReplaceCommand(deleteRange, ''), {
shouldPushStackElementBefore: (deleteRange.startLineNumber !== deleteRange.endLineNumber),
shouldPushStackElementAfter: false
});
}
private static _findFirstNonWhitespaceChar(str: string, startIndex: number): number {
let len = str.length;
for (let chIndex = startIndex; chIndex < len; chIndex++) {
......@@ -366,7 +353,7 @@ export class WordOperations {
return null;
}
private static _deleteWordRight(wordSeparators: WordCharacterClassifier, model: ICursorSimpleModel, selection: Selection, whitespaceHeuristics: boolean, wordNavigationType: WordNavigationType): Range {
public static _deleteWordRight(wordSeparators: WordCharacterClassifier, model: ICursorSimpleModel, selection: Selection, whitespaceHeuristics: boolean, wordNavigationType: WordNavigationType): Range {
if (!selection.isEmpty()) {
return selection;
}
......@@ -432,18 +419,6 @@ export class WordOperations {
return new Range(lineNumber, column, position.lineNumber, position.column);
}
public static deleteWordRight(config: CursorConfiguration, model: ICursorSimpleModel, cursor: SingleCursorState, whitespaceHeuristics: boolean, wordNavigationType: WordNavigationType): EditOperationResult {
const wordSeparators = getMapForWordSeparators(config.wordSeparators);
const deleteRange = this._deleteWordRight(wordSeparators, model, cursor.selection, whitespaceHeuristics, wordNavigationType);
if (!deleteRange) {
return null;
}
return new EditOperationResult(new ReplaceCommand(deleteRange, ''), {
shouldPushStackElementBefore: (deleteRange.startLineNumber !== deleteRange.endLineNumber),
shouldPushStackElementAfter: false
});
}
public static word(config: CursorConfiguration, model: ICursorSimpleModel, cursor: SingleCursorState, inSelectionMode: boolean, position: Position): SingleMoveOperationResult {
const wordSeparators = getMapForWordSeparators(config.wordSeparators);
let prevWord = WordOperations.findPreviousWordOnLine(wordSeparators, model, position);
......
......@@ -4438,14 +4438,6 @@ export var Handler = {
DeleteLeft: 'deleteLeft',
DeleteRight: 'deleteRight',
DeleteWordLeft: 'deleteWordLeft',
DeleteWordStartLeft: 'deleteWordStartLeft',
DeleteWordEndLeft: 'deleteWordEndLeft',
DeleteWordRight: 'deleteWordRight',
DeleteWordStartRight: 'deleteWordStartRight',
DeleteWordEndRight: 'deleteWordEndRight',
RemoveSecondaryCursors: 'removeSecondaryCursors',
CancelSelection: 'cancelSelection',
......
......@@ -10,14 +10,16 @@ import { EditorContextKeys, ICommonCodeEditor, IModel } from 'vs/editor/common/e
import { Selection } from 'vs/editor/common/core/selection';
import { editorCommand, ServicesAccessor, EditorCommand, ICommandOptions } from 'vs/editor/common/editorCommonExtensions';
import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import { WordNavigationType, WordOperations, getMapForWordSeparators, WordCharacterClassifier } from 'vs/editor/common/controller/cursorWordOperations';
import { ReplaceCommand } from 'vs/editor/common/commands/replaceCommand';
export interface MoveWordOptions extends ICommandOptions {
inSelectionMode: boolean;
wordNavigationType: WordNavigationType;
}
export abstract class WordCommand extends EditorCommand {
export abstract class MoveWordCommand extends EditorCommand {
private readonly _inSelectionMode: boolean;
private readonly _wordNavigationType: WordNavigationType;
......@@ -37,22 +39,42 @@ export abstract class WordCommand extends EditorCommand {
const result = selections.map((sel) => {
const inPosition = new Position(sel.positionLineNumber, sel.positionColumn);
const outPosition = this._move(wordSeparators, model, inPosition, this._wordNavigationType);
return move(sel, outPosition, this._inSelectionMode);
return this._moveTo(sel, outPosition, this._inSelectionMode);
});
editor.setSelections(result);
}
private _moveTo(from: Selection, to: Position, inSelectionMode: boolean): Selection {
if (inSelectionMode) {
// move just position
return new Selection(
from.selectionStartLineNumber,
from.selectionStartColumn,
to.lineNumber,
to.column
);
} else {
// move everything
return new Selection(
to.lineNumber,
to.column,
to.lineNumber,
to.column
);
}
}
protected abstract _move(wordSeparators: WordCharacterClassifier, model: IModel, position: Position, wordNavigationType: WordNavigationType): Position;
}
export class WordLeftCommand extends WordCommand {
export class WordLeftCommand extends MoveWordCommand {
protected _move(wordSeparators: WordCharacterClassifier, model: IModel, position: Position, wordNavigationType: WordNavigationType): Position {
return WordOperations.moveWordLeft(wordSeparators, model, position, wordNavigationType);
}
}
export class WordRightCommand extends WordCommand {
export class WordRightCommand extends MoveWordCommand {
protected _move(wordSeparators: WordCharacterClassifier, model: IModel, position: Position, wordNavigationType: WordNavigationType): Position {
return WordOperations.moveWordRight(wordSeparators, model, position, wordNavigationType);
}
......@@ -222,22 +244,138 @@ export class CursorWordRightSelect extends WordRightCommand {
}
}
function move(from: Selection, to: Position, inSelectionMode: boolean): Selection {
if (inSelectionMode) {
// move just position
return new Selection(
from.selectionStartLineNumber,
from.selectionStartColumn,
to.lineNumber,
to.column
);
} else {
// move everything
return new Selection(
to.lineNumber,
to.column,
to.lineNumber,
to.column
);
export interface DeleteWordOptions extends ICommandOptions {
whitespaceHeuristics: boolean;
wordNavigationType: WordNavigationType;
}
export abstract class DeleteWordCommand extends EditorCommand {
private readonly _whitespaceHeuristics: boolean;
private readonly _wordNavigationType: WordNavigationType;
constructor(opts: DeleteWordOptions) {
super(opts);
this._whitespaceHeuristics = opts.whitespaceHeuristics;
this._wordNavigationType = opts.wordNavigationType;
}
public runEditorCommand(accessor: ServicesAccessor, editor: ICommonCodeEditor, args: any): void {
const config = editor.getConfiguration();
const wordSeparators = getMapForWordSeparators(config.wordSeparators);
const model = editor.getModel();
const selections = editor.getSelections();
const commands = selections.map((sel) => {
const deleteRange = this._delete(wordSeparators, model, sel, this._whitespaceHeuristics, this._wordNavigationType);
return new ReplaceCommand(deleteRange, '');
});
editor.executeCommands(this.id, commands);
}
protected abstract _delete(wordSeparators: WordCharacterClassifier, model: IModel, selection: Selection, whitespaceHeuristics: boolean, wordNavigationType: WordNavigationType): Range;
}
export class DeleteWordLeftCommand extends DeleteWordCommand {
protected _delete(wordSeparators: WordCharacterClassifier, model: IModel, selection: Selection, whitespaceHeuristics: boolean, wordNavigationType: WordNavigationType): Range {
let r = WordOperations._deleteWordLeft(wordSeparators, model, selection, whitespaceHeuristics, wordNavigationType);
if (r) {
return r;
}
return new Range(1, 1, 1, 1);
}
}
export class DeleteWordRightCommand extends DeleteWordCommand {
protected _delete(wordSeparators: WordCharacterClassifier, model: IModel, selection: Selection, whitespaceHeuristics: boolean, wordNavigationType: WordNavigationType): Range {
let r = WordOperations._deleteWordRight(wordSeparators, model, selection, whitespaceHeuristics, wordNavigationType);
if (r) {
return r;
}
const lineCount = model.getLineCount();
const maxColumn = model.getLineMaxColumn(lineCount);
return new Range(lineCount, maxColumn, lineCount, maxColumn);
}
}
@editorCommand
export class DeleteWordStartLeft extends DeleteWordLeftCommand {
constructor() {
super({
whitespaceHeuristics: false,
wordNavigationType: WordNavigationType.WordStart,
id: 'deleteWordStartLeft',
precondition: EditorContextKeys.Writable
});
}
}
@editorCommand
export class DeleteWordEndLeft extends DeleteWordLeftCommand {
constructor() {
super({
whitespaceHeuristics: false,
wordNavigationType: WordNavigationType.WordEnd,
id: 'deleteWordEndLeft',
precondition: EditorContextKeys.Writable
});
}
}
@editorCommand
export class DeleteWordLeft extends DeleteWordLeftCommand {
constructor() {
super({
whitespaceHeuristics: true,
wordNavigationType: WordNavigationType.WordStart,
id: 'deleteWordLeft',
precondition: EditorContextKeys.Writable,
kbOpts: {
kbExpr: EditorContextKeys.TextFocus,
primary: KeyMod.CtrlCmd | KeyCode.Backspace,
mac: { primary: KeyMod.Alt | KeyCode.Backspace }
}
});
}
}
@editorCommand
export class DeleteWordStartRight extends DeleteWordRightCommand {
constructor() {
super({
whitespaceHeuristics: false,
wordNavigationType: WordNavigationType.WordStart,
id: 'deleteWordStartRight',
precondition: EditorContextKeys.Writable
});
}
}
@editorCommand
export class DeleteWordEndRight extends DeleteWordRightCommand {
constructor() {
super({
whitespaceHeuristics: false,
wordNavigationType: WordNavigationType.WordEnd,
id: 'deleteWordEndRight',
precondition: EditorContextKeys.Writable
});
}
}
@editorCommand
export class DeleteWordRight extends DeleteWordRightCommand {
constructor() {
super({
whitespaceHeuristics: true,
wordNavigationType: WordNavigationType.WordEnd,
id: 'deleteWordRight',
precondition: EditorContextKeys.Writable,
kbOpts: {
kbExpr: EditorContextKeys.TextFocus,
primary: KeyMod.CtrlCmd | KeyCode.Delete,
mac: { primary: KeyMod.Alt | KeyCode.Delete }
}
});
}
}
......@@ -13,7 +13,9 @@ import {
CursorWordLeft, CursorWordLeftSelect, CursorWordStartLeft,
CursorWordEndLeft, CursorWordStartLeftSelect, CursorWordEndLeftSelect,
CursorWordStartRight, CursorWordEndRight, CursorWordRight,
CursorWordStartRightSelect, CursorWordEndRightSelect, CursorWordRightSelect
CursorWordStartRightSelect, CursorWordEndRightSelect, CursorWordRightSelect,
DeleteWordLeft, DeleteWordStartLeft, DeleteWordEndLeft,
DeleteWordRight, DeleteWordStartRight, DeleteWordEndRight
} from 'vs/editor/contrib/wordOperations/common/wordOperations';
import { EditorCommand } from 'vs/editor/common/config/config';
......@@ -31,6 +33,12 @@ suite('WordOperations', () => {
const _cursorWordStartRightSelect = new CursorWordStartRightSelect();
const _cursorWordEndRightSelect = new CursorWordEndRightSelect();
const _cursorWordRightSelect = new CursorWordRightSelect();
const _deleteWordLeft = new DeleteWordLeft();
const _deleteWordStartLeft = new DeleteWordStartLeft();
const _deleteWordEndLeft = new DeleteWordEndLeft();
const _deleteWordRight = new DeleteWordRight();
const _deleteWordStartRight = new DeleteWordStartRight();
const _deleteWordEndRight = new DeleteWordEndRight();
function runEditorCommand(editor: ICommonCodeEditor, command: EditorCommand): void {
command.runEditorCommand(null, editor, null);
......@@ -53,6 +61,24 @@ suite('WordOperations', () => {
function moveWordStartRight(editor: ICommonCodeEditor, inSelectionMode: boolean = false): void {
runEditorCommand(editor, inSelectionMode ? _cursorWordStartRightSelect : _cursorWordStartRight);
}
function deleteWordLeft(editor: ICommonCodeEditor): void {
runEditorCommand(editor, _deleteWordLeft);
}
function deleteWordStartLeft(editor: ICommonCodeEditor): void {
runEditorCommand(editor, _deleteWordStartLeft);
}
function deleteWordEndLeft(editor: ICommonCodeEditor): void {
runEditorCommand(editor, _deleteWordEndLeft);
}
function deleteWordRight(editor: ICommonCodeEditor): void {
runEditorCommand(editor, _deleteWordRight);
}
function deleteWordStartRight(editor: ICommonCodeEditor): void {
runEditorCommand(editor, _deleteWordStartRight);
}
function deleteWordEndRight(editor: ICommonCodeEditor): void {
runEditorCommand(editor, _deleteWordEndRight);
}
test('move word left', () => {
withMockCodeEditor([
......@@ -303,4 +329,347 @@ suite('WordOperations', () => {
moveWordStartRight(editor); assert.equal(editor.getPosition().column, ' /* Just some more text a+= 3 +5-3 + 7 */ '.length + 1, '016');
});
});
test('delete word left for non-empty selection', () => {
withMockCodeEditor([
' \tMy First Line\t ',
'\tMy Second Line',
' Third Line🐶',
'',
'1',
], {}, (editor, _) => {
const model = editor.getModel();
editor.setSelection(new Selection(3, 7, 3, 9));
deleteWordLeft(editor);
assert.equal(model.getLineContent(3), ' Thd Line🐶');
assert.deepEqual(editor.getPosition(), new Position(3, 7));
});
});
test('delete word left for caret at beginning of document', () => {
withMockCodeEditor([
' \tMy First Line\t ',
'\tMy Second Line',
' Third Line🐶',
'',
'1',
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(1, 1));
deleteWordLeft(editor);
assert.equal(model.getLineContent(1), ' \tMy First Line\t ');
assert.deepEqual(editor.getPosition(), new Position(1, 1));
});
});
test('delete word left for caret at end of whitespace', () => {
withMockCodeEditor([
' \tMy First Line\t ',
'\tMy Second Line',
' Third Line🐶',
'',
'1',
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(3, 11));
deleteWordLeft(editor);
assert.equal(model.getLineContent(3), ' Line🐶');
assert.deepEqual(editor.getPosition(), new Position(3, 5));
});
});
test('delete word left for caret just behind a word', () => {
withMockCodeEditor([
' \tMy First Line\t ',
'\tMy Second Line',
' Third Line🐶',
'',
'1',
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(2, 11));
deleteWordLeft(editor);
assert.equal(model.getLineContent(2), '\tMy Line');
assert.deepEqual(editor.getPosition(), new Position(2, 5));
});
});
test('delete word left for caret inside of a word', () => {
withMockCodeEditor([
' \tMy First Line\t ',
'\tMy Second Line',
' Third Line🐶',
'',
'1',
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(1, 12));
deleteWordLeft(editor);
assert.equal(model.getLineContent(1), ' \tMy st Line\t ');
assert.deepEqual(editor.getPosition(), new Position(1, 9));
});
});
test('delete word right for non-empty selection', () => {
withMockCodeEditor([
' \tMy First Line\t ',
'\tMy Second Line',
' Third Line🐶',
'',
'1',
], {}, (editor, _) => {
const model = editor.getModel();
editor.setSelection(new Selection(3, 7, 3, 9));
deleteWordRight(editor);
assert.equal(model.getLineContent(3), ' Thd Line🐶');
assert.deepEqual(editor.getPosition(), new Position(3, 7));
});
});
test('delete word right for caret at end of document', () => {
withMockCodeEditor([
' \tMy First Line\t ',
'\tMy Second Line',
' Third Line🐶',
'',
'1',
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(5, 3));
deleteWordRight(editor);
assert.equal(model.getLineContent(5), '1');
assert.deepEqual(editor.getPosition(), new Position(5, 2));
});
});
test('delete word right for caret at beggining of whitespace', () => {
withMockCodeEditor([
' \tMy First Line\t ',
'\tMy Second Line',
' Third Line🐶',
'',
'1',
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(3, 1));
deleteWordRight(editor);
assert.equal(model.getLineContent(3), 'Third Line🐶');
assert.deepEqual(editor.getPosition(), new Position(3, 1));
});
});
test('delete word right for caret just before a word', () => {
withMockCodeEditor([
' \tMy First Line\t ',
'\tMy Second Line',
' Third Line🐶',
'',
'1',
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(2, 5));
deleteWordRight(editor);
assert.equal(model.getLineContent(2), '\tMy Line');
assert.deepEqual(editor.getPosition(), new Position(2, 5));
});
});
test('delete word right for caret inside of a word', () => {
withMockCodeEditor([
' \tMy First Line\t ',
'\tMy Second Line',
' Third Line🐶',
'',
'1',
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(1, 11));
deleteWordRight(editor);
assert.equal(model.getLineContent(1), ' \tMy Fi Line\t ');
assert.deepEqual(editor.getPosition(), new Position(1, 11));
});
});
test('issue #832: deleteWordLeft', () => {
withMockCodeEditor([
' /* Just some text a+= 3 +5 */ '
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(1, 37));
deleteWordLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 +5 */', '001');
deleteWordLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 +5 ', '002');
deleteWordLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 +', '003');
deleteWordLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 ', '004');
deleteWordLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text a+= ', '005');
deleteWordLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text a', '006');
deleteWordLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text ', '007');
deleteWordLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some ', '008');
deleteWordLeft(editor); assert.equal(model.getLineContent(1), ' /* Just ', '009');
deleteWordLeft(editor); assert.equal(model.getLineContent(1), ' /* ', '010');
deleteWordLeft(editor); assert.equal(model.getLineContent(1), ' ', '011');
deleteWordLeft(editor); assert.equal(model.getLineContent(1), '', '012');
});
});
test('deleteWordStartLeft', () => {
withMockCodeEditor([
' /* Just some text a+= 3 +5 */ '
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(1, 37));
deleteWordStartLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 +5 ', '001');
deleteWordStartLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 +', '002');
deleteWordStartLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 ', '003');
deleteWordStartLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text a+= ', '004');
deleteWordStartLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text a', '005');
deleteWordStartLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text ', '006');
deleteWordStartLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some ', '007');
deleteWordStartLeft(editor); assert.equal(model.getLineContent(1), ' /* Just ', '008');
deleteWordStartLeft(editor); assert.equal(model.getLineContent(1), ' /* ', '009');
deleteWordStartLeft(editor); assert.equal(model.getLineContent(1), ' ', '010');
deleteWordStartLeft(editor); assert.equal(model.getLineContent(1), '', '011');
});
});
test('deleteWordEndLeft', () => {
withMockCodeEditor([
' /* Just some text a+= 3 +5 */ '
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(1, 37));
deleteWordEndLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 +5 */', '001');
deleteWordEndLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 +5', '002');
deleteWordEndLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 +', '003');
deleteWordEndLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3', '004');
deleteWordEndLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text a+=', '005');
deleteWordEndLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text a', '006');
deleteWordEndLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some text', '007');
deleteWordEndLeft(editor); assert.equal(model.getLineContent(1), ' /* Just some', '008');
deleteWordEndLeft(editor); assert.equal(model.getLineContent(1), ' /* Just', '009');
deleteWordEndLeft(editor); assert.equal(model.getLineContent(1), ' /*', '010');
deleteWordEndLeft(editor); assert.equal(model.getLineContent(1), '', '011');
});
});
test('issue #832: deleteWordRight', () => {
withMockCodeEditor([
' /* Just some text a+= 3 +5-3 */ '
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(1, 1));
deleteWordRight(editor); assert.equal(model.getLineContent(1), '/* Just some text a+= 3 +5-3 */ ', '001');
deleteWordRight(editor); assert.equal(model.getLineContent(1), ' Just some text a+= 3 +5-3 */ ', '002');
deleteWordRight(editor); assert.equal(model.getLineContent(1), ' some text a+= 3 +5-3 */ ', '003');
deleteWordRight(editor); assert.equal(model.getLineContent(1), ' text a+= 3 +5-3 */ ', '004');
deleteWordRight(editor); assert.equal(model.getLineContent(1), ' a+= 3 +5-3 */ ', '005');
deleteWordRight(editor); assert.equal(model.getLineContent(1), '+= 3 +5-3 */ ', '006');
deleteWordRight(editor); assert.equal(model.getLineContent(1), ' 3 +5-3 */ ', '007');
deleteWordRight(editor); assert.equal(model.getLineContent(1), ' +5-3 */ ', '008');
deleteWordRight(editor); assert.equal(model.getLineContent(1), '5-3 */ ', '009');
deleteWordRight(editor); assert.equal(model.getLineContent(1), '-3 */ ', '010');
deleteWordRight(editor); assert.equal(model.getLineContent(1), '3 */ ', '011');
deleteWordRight(editor); assert.equal(model.getLineContent(1), ' */ ', '012');
deleteWordRight(editor); assert.equal(model.getLineContent(1), ' ', '013');
});
});
test('issue #3882: deleteWordRight', () => {
withMockCodeEditor([
'public void Add( int x,',
' int y )'
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(1, 24));
deleteWordRight(editor); assert.equal(model.getLineContent(1), 'public void Add( int x,int y )', '001');
});
});
test('issue #3882: deleteWordStartRight', () => {
withMockCodeEditor([
'public void Add( int x,',
' int y )'
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(1, 24));
deleteWordStartRight(editor); assert.equal(model.getLineContent(1), 'public void Add( int x,int y )', '001');
});
});
test('issue #3882: deleteWordEndRight', () => {
withMockCodeEditor([
'public void Add( int x,',
' int y )'
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(1, 24));
deleteWordEndRight(editor); assert.equal(model.getLineContent(1), 'public void Add( int x,int y )', '001');
});
});
test('deleteWordStartRight', () => {
withMockCodeEditor([
' /* Just some text a+= 3 +5-3 */ '
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(1, 1));
deleteWordStartRight(editor); assert.equal(model.getLineContent(1), '/* Just some text a+= 3 +5-3 */ ', '001');
deleteWordStartRight(editor); assert.equal(model.getLineContent(1), 'Just some text a+= 3 +5-3 */ ', '002');
deleteWordStartRight(editor); assert.equal(model.getLineContent(1), 'some text a+= 3 +5-3 */ ', '003');
deleteWordStartRight(editor); assert.equal(model.getLineContent(1), 'text a+= 3 +5-3 */ ', '004');
deleteWordStartRight(editor); assert.equal(model.getLineContent(1), 'a+= 3 +5-3 */ ', '005');
deleteWordStartRight(editor); assert.equal(model.getLineContent(1), '+= 3 +5-3 */ ', '006');
deleteWordStartRight(editor); assert.equal(model.getLineContent(1), '3 +5-3 */ ', '007');
deleteWordStartRight(editor); assert.equal(model.getLineContent(1), '+5-3 */ ', '008');
deleteWordStartRight(editor); assert.equal(model.getLineContent(1), '5-3 */ ', '009');
deleteWordStartRight(editor); assert.equal(model.getLineContent(1), '-3 */ ', '010');
deleteWordStartRight(editor); assert.equal(model.getLineContent(1), '3 */ ', '011');
deleteWordStartRight(editor); assert.equal(model.getLineContent(1), '*/ ', '012');
deleteWordStartRight(editor); assert.equal(model.getLineContent(1), '', '013');
});
});
test('deleteWordEndRight', () => {
withMockCodeEditor([
' /* Just some text a+= 3 +5-3 */ '
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(1, 1));
deleteWordEndRight(editor); assert.equal(model.getLineContent(1), ' Just some text a+= 3 +5-3 */ ', '001');
deleteWordEndRight(editor); assert.equal(model.getLineContent(1), ' some text a+= 3 +5-3 */ ', '002');
deleteWordEndRight(editor); assert.equal(model.getLineContent(1), ' text a+= 3 +5-3 */ ', '003');
deleteWordEndRight(editor); assert.equal(model.getLineContent(1), ' a+= 3 +5-3 */ ', '004');
deleteWordEndRight(editor); assert.equal(model.getLineContent(1), '+= 3 +5-3 */ ', '005');
deleteWordEndRight(editor); assert.equal(model.getLineContent(1), ' 3 +5-3 */ ', '006');
deleteWordEndRight(editor); assert.equal(model.getLineContent(1), ' +5-3 */ ', '007');
deleteWordEndRight(editor); assert.equal(model.getLineContent(1), '5-3 */ ', '008');
deleteWordEndRight(editor); assert.equal(model.getLineContent(1), '-3 */ ', '009');
deleteWordEndRight(editor); assert.equal(model.getLineContent(1), '3 */ ', '010');
deleteWordEndRight(editor); assert.equal(model.getLineContent(1), ' */ ', '011');
deleteWordEndRight(editor); assert.equal(model.getLineContent(1), ' ', '012');
});
});
test('issue #3882 (1): Ctrl+Delete removing entire line when used at the end of line', () => {
withMockCodeEditor([
'A line with text.',
' And another one'
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(1, 18));
deleteWordRight(editor); assert.equal(model.getLineContent(1), 'A line with text.And another one', '001');
});
});
test('issue #3882 (2): Ctrl+Delete removing entire line when used at the end of line', () => {
withMockCodeEditor([
'A line with text.',
' And another one'
], {}, (editor, _) => {
const model = editor.getModel();
editor.setPosition(new Position(2, 1));
deleteWordLeft(editor); assert.equal(model.getLineContent(1), 'A line with text And another one', '001');
});
});
});
......@@ -76,26 +76,6 @@ function moveToEndOfBuffer(cursor: Cursor, inSelectionMode: boolean = false) {
cursorCommand(cursor, inSelectionMode ? H.CursorBottomSelect : H.CursorBottom);
}
function deleteWordLeft(cursor: Cursor) {
cursorCommand(cursor, H.DeleteWordLeft);
}
function deleteWordStartLeft(cursor: Cursor) {
cursorCommand(cursor, H.DeleteWordStartLeft);
}
function deleteWordEndLeft(cursor: Cursor) {
cursorCommand(cursor, H.DeleteWordEndLeft);
}
function deleteWordRight(cursor: Cursor) {
cursorCommand(cursor, H.DeleteWordRight);
}
function deleteWordStartRight(cursor: Cursor) {
cursorCommand(cursor, H.DeleteWordStartRight);
}
function deleteWordEndRight(cursor: Cursor) {
cursorCommand(cursor, H.DeleteWordEndRight);
}
function assertCursor(cursor: Cursor, what: Position | Selection | Selection[]): void {
let selections: Selection[];
if (what instanceof Position) {
......@@ -567,82 +547,6 @@ suite('Editor Controller - Cursor', () => {
assertCursor(thisCursor, new Selection(3, 3, 5, LINE5.length + 1));
});
// --------- delete word left/right
test('delete word left for non-empty selection', () => {
moveTo(thisCursor, 3, 7);
moveRight(thisCursor, true);
moveRight(thisCursor, true);
deleteWordLeft(thisCursor);
assert.equal(thisModel.getLineContent(3), ' Thd Line🐶');
assertCursor(thisCursor, new Position(3, 7));
});
test('delete word left for caret at beginning of document', () => {
moveTo(thisCursor, 1, 1);
deleteWordLeft(thisCursor);
assert.equal(thisModel.getLineContent(1), ' \tMy First Line\t ');
assertCursor(thisCursor, new Position(1, 1));
});
test('delete word left for caret at end of whitespace', () => {
moveTo(thisCursor, 3, 11);
deleteWordLeft(thisCursor);
assert.equal(thisModel.getLineContent(3), ' Line🐶');
assertCursor(thisCursor, new Position(3, 5));
});
test('delete word left for caret just behind a word', () => {
moveTo(thisCursor, 2, 11);
deleteWordLeft(thisCursor);
assert.equal(thisModel.getLineContent(2), '\tMy Line');
assertCursor(thisCursor, new Position(2, 5));
});
test('delete word left for caret inside of a word', () => {
moveTo(thisCursor, 1, 12);
deleteWordLeft(thisCursor);
assert.equal(thisModel.getLineContent(1), ' \tMy st Line\t ');
assertCursor(thisCursor, new Position(1, 9));
});
test('delete word right for non-empty selection', () => {
moveTo(thisCursor, 3, 7);
moveRight(thisCursor, true);
moveRight(thisCursor, true);
deleteWordRight(thisCursor);
assert.equal(thisModel.getLineContent(3), ' Thd Line🐶');
assertCursor(thisCursor, new Position(3, 7));
});
test('delete word right for caret at end of document', () => {
moveTo(thisCursor, 5, 3);
deleteWordRight(thisCursor);
assert.equal(thisModel.getLineContent(5), '1');
assertCursor(thisCursor, new Position(5, 2));
});
test('delete word right for caret at beggining of whitespace', () => {
moveTo(thisCursor, 3, 1);
deleteWordRight(thisCursor);
assert.equal(thisModel.getLineContent(3), 'Third Line🐶');
assertCursor(thisCursor, new Position(3, 1));
});
test('delete word right for caret just before a word', () => {
moveTo(thisCursor, 2, 5);
deleteWordRight(thisCursor);
assert.equal(thisModel.getLineContent(2), '\tMy Line');
assertCursor(thisCursor, new Position(2, 5));
});
test('delete word right for caret inside of a word', () => {
moveTo(thisCursor, 1, 11);
deleteWordRight(thisCursor);
assert.equal(thisModel.getLineContent(1), ' \tMy Fi Line\t ');
assertCursor(thisCursor, new Position(1, 11));
});
// --------- misc
test('select all', () => {
......@@ -1699,176 +1603,6 @@ suite('Editor Controller - Regression tests', () => {
});
});
test('issue #832: deleteWordLeft', () => {
usingCursor({
text: [
' /* Just some text a+= 3 +5 */ '
],
}, (model, cursor) => {
moveTo(cursor, 1, 37, false);
deleteWordLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 +5 */', '001');
deleteWordLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 +5 ', '002');
deleteWordLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 +', '003');
deleteWordLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 ', '004');
deleteWordLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text a+= ', '005');
deleteWordLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text a', '006');
deleteWordLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text ', '007');
deleteWordLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some ', '008');
deleteWordLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just ', '009');
deleteWordLeft(cursor); assert.equal(model.getLineContent(1), ' /* ', '010');
deleteWordLeft(cursor); assert.equal(model.getLineContent(1), ' ', '011');
deleteWordLeft(cursor); assert.equal(model.getLineContent(1), '', '012');
});
});
test('deleteWordStartLeft', () => {
usingCursor({
text: [
' /* Just some text a+= 3 +5 */ '
],
}, (model, cursor) => {
moveTo(cursor, 1, 37, false);
deleteWordStartLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 +5 ', '001');
deleteWordStartLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 +', '002');
deleteWordStartLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 ', '003');
deleteWordStartLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text a+= ', '004');
deleteWordStartLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text a', '005');
deleteWordStartLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text ', '006');
deleteWordStartLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some ', '007');
deleteWordStartLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just ', '008');
deleteWordStartLeft(cursor); assert.equal(model.getLineContent(1), ' /* ', '009');
deleteWordStartLeft(cursor); assert.equal(model.getLineContent(1), ' ', '010');
deleteWordStartLeft(cursor); assert.equal(model.getLineContent(1), '', '011');
});
});
test('deleteWordEndLeft', () => {
usingCursor({
text: [
' /* Just some text a+= 3 +5 */ '
],
}, (model, cursor) => {
moveTo(cursor, 1, 37, false);
deleteWordEndLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 +5 */', '001');
deleteWordEndLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 +5', '002');
deleteWordEndLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3 +', '003');
deleteWordEndLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text a+= 3', '004');
deleteWordEndLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text a+=', '005');
deleteWordEndLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text a', '006');
deleteWordEndLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some text', '007');
deleteWordEndLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just some', '008');
deleteWordEndLeft(cursor); assert.equal(model.getLineContent(1), ' /* Just', '009');
deleteWordEndLeft(cursor); assert.equal(model.getLineContent(1), ' /*', '010');
deleteWordEndLeft(cursor); assert.equal(model.getLineContent(1), '', '011');
});
});
test('issue #832: deleteWordRight', () => {
usingCursor({
text: [
' /* Just some text a+= 3 +5-3 */ '
],
}, (model, cursor) => {
moveTo(cursor, 1, 1, false);
deleteWordRight(cursor); assert.equal(model.getLineContent(1), '/* Just some text a+= 3 +5-3 */ ', '001');
deleteWordRight(cursor); assert.equal(model.getLineContent(1), ' Just some text a+= 3 +5-3 */ ', '002');
deleteWordRight(cursor); assert.equal(model.getLineContent(1), ' some text a+= 3 +5-3 */ ', '003');
deleteWordRight(cursor); assert.equal(model.getLineContent(1), ' text a+= 3 +5-3 */ ', '004');
deleteWordRight(cursor); assert.equal(model.getLineContent(1), ' a+= 3 +5-3 */ ', '005');
deleteWordRight(cursor); assert.equal(model.getLineContent(1), '+= 3 +5-3 */ ', '006');
deleteWordRight(cursor); assert.equal(model.getLineContent(1), ' 3 +5-3 */ ', '007');
deleteWordRight(cursor); assert.equal(model.getLineContent(1), ' +5-3 */ ', '008');
deleteWordRight(cursor); assert.equal(model.getLineContent(1), '5-3 */ ', '009');
deleteWordRight(cursor); assert.equal(model.getLineContent(1), '-3 */ ', '010');
deleteWordRight(cursor); assert.equal(model.getLineContent(1), '3 */ ', '011');
deleteWordRight(cursor); assert.equal(model.getLineContent(1), ' */ ', '012');
deleteWordRight(cursor); assert.equal(model.getLineContent(1), ' ', '013');
});
});
test('issue #3882: deleteWordRight', () => {
usingCursor({
text: [
'public void Add( int x,',
' int y )'
],
}, (model, cursor) => {
moveTo(cursor, 1, 24, false);
deleteWordRight(cursor); assert.equal(model.getLineContent(1), 'public void Add( int x,int y )', '001');
});
});
test('issue #3882: deleteWordStartRight', () => {
usingCursor({
text: [
'public void Add( int x,',
' int y )'
],
}, (model, cursor) => {
moveTo(cursor, 1, 24, false);
deleteWordStartRight(cursor); assert.equal(model.getLineContent(1), 'public void Add( int x,int y )', '001');
});
});
test('issue #3882: deleteWordEndRight', () => {
usingCursor({
text: [
'public void Add( int x,',
' int y )'
],
}, (model, cursor) => {
moveTo(cursor, 1, 24, false);
deleteWordEndRight(cursor); assert.equal(model.getLineContent(1), 'public void Add( int x,int y )', '001');
});
});
test('deleteWordStartRight', () => {
usingCursor({
text: [
' /* Just some text a+= 3 +5-3 */ '
],
}, (model, cursor) => {
moveTo(cursor, 1, 1, false);
deleteWordStartRight(cursor); assert.equal(model.getLineContent(1), '/* Just some text a+= 3 +5-3 */ ', '001');
deleteWordStartRight(cursor); assert.equal(model.getLineContent(1), 'Just some text a+= 3 +5-3 */ ', '002');
deleteWordStartRight(cursor); assert.equal(model.getLineContent(1), 'some text a+= 3 +5-3 */ ', '003');
deleteWordStartRight(cursor); assert.equal(model.getLineContent(1), 'text a+= 3 +5-3 */ ', '004');
deleteWordStartRight(cursor); assert.equal(model.getLineContent(1), 'a+= 3 +5-3 */ ', '005');
deleteWordStartRight(cursor); assert.equal(model.getLineContent(1), '+= 3 +5-3 */ ', '006');
deleteWordStartRight(cursor); assert.equal(model.getLineContent(1), '3 +5-3 */ ', '007');
deleteWordStartRight(cursor); assert.equal(model.getLineContent(1), '+5-3 */ ', '008');
deleteWordStartRight(cursor); assert.equal(model.getLineContent(1), '5-3 */ ', '009');
deleteWordStartRight(cursor); assert.equal(model.getLineContent(1), '-3 */ ', '010');
deleteWordStartRight(cursor); assert.equal(model.getLineContent(1), '3 */ ', '011');
deleteWordStartRight(cursor); assert.equal(model.getLineContent(1), '*/ ', '012');
deleteWordStartRight(cursor); assert.equal(model.getLineContent(1), '', '013');
});
});
test('deleteWordEndRight', () => {
usingCursor({
text: [
' /* Just some text a+= 3 +5-3 */ '
],
}, (model, cursor) => {
moveTo(cursor, 1, 1, false);
deleteWordEndRight(cursor); assert.equal(model.getLineContent(1), ' Just some text a+= 3 +5-3 */ ', '001');
deleteWordEndRight(cursor); assert.equal(model.getLineContent(1), ' some text a+= 3 +5-3 */ ', '002');
deleteWordEndRight(cursor); assert.equal(model.getLineContent(1), ' text a+= 3 +5-3 */ ', '003');
deleteWordEndRight(cursor); assert.equal(model.getLineContent(1), ' a+= 3 +5-3 */ ', '004');
deleteWordEndRight(cursor); assert.equal(model.getLineContent(1), '+= 3 +5-3 */ ', '005');
deleteWordEndRight(cursor); assert.equal(model.getLineContent(1), ' 3 +5-3 */ ', '006');
deleteWordEndRight(cursor); assert.equal(model.getLineContent(1), ' +5-3 */ ', '007');
deleteWordEndRight(cursor); assert.equal(model.getLineContent(1), '5-3 */ ', '008');
deleteWordEndRight(cursor); assert.equal(model.getLineContent(1), '-3 */ ', '009');
deleteWordEndRight(cursor); assert.equal(model.getLineContent(1), '3 */ ', '010');
deleteWordEndRight(cursor); assert.equal(model.getLineContent(1), ' */ ', '011');
deleteWordEndRight(cursor); assert.equal(model.getLineContent(1), ' ', '012');
});
});
test('issue #832: word right', () => {
usingCursor({
......@@ -1944,30 +1678,6 @@ suite('Editor Controller - Regression tests', () => {
});
});
test('issue #3882 (1): Ctrl+Delete removing entire line when used at the end of line', () => {
usingCursor({
text: [
'A line with text.',
' And another one'
],
}, (model, cursor) => {
moveTo(cursor, 1, 18, false);
deleteWordRight(cursor); assert.equal(model.getLineContent(1), 'A line with text.And another one', '001');
});
});
test('issue #3882 (2): Ctrl+Delete removing entire line when used at the end of line', () => {
usingCursor({
text: [
'A line with text.',
' And another one'
],
}, (model, cursor) => {
moveTo(cursor, 2, 1, false);
deleteWordLeft(cursor); assert.equal(model.getLineContent(1), 'A line with text And another one', '001');
});
});
test('issue #9675: Undo/Redo adds a stop in between CHN Characters', () => {
usingCursor({
text: [
......
......@@ -3494,12 +3494,6 @@ declare module monaco.editor {
Outdent: string;
DeleteLeft: string;
DeleteRight: string;
DeleteWordLeft: string;
DeleteWordStartLeft: string;
DeleteWordEndLeft: string;
DeleteWordRight: string;
DeleteWordStartRight: string;
DeleteWordEndRight: string;
RemoveSecondaryCursors: string;
CancelSelection: string;
Cut: string;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册