mirror of
https://github.com/VSCodeVim/Vim.git
synced 2024-11-10 22:29:25 +03:00
Fix A/I with dot.
This commit is contained in:
parent
50568f9aae
commit
50e682f3fd
@ -495,7 +495,7 @@ class CommandInsertInInsertMode extends BaseCommand {
|
||||
if (char === "<backspace>") {
|
||||
await TextEditor.delete(new vscode.Range(position, position.getLeft()));
|
||||
} else {
|
||||
await TextEditor.insert(char);
|
||||
await TextEditor.insert(char, vimState.cursorPosition);
|
||||
}
|
||||
|
||||
vimState.cursorStartPosition = Position.FromVSCodePosition(vscode.window.activeTextEditor.selection.start);
|
||||
|
@ -2,9 +2,14 @@
|
||||
|
||||
import * as vscode from "vscode";
|
||||
import { ModeHandler } from './mode/modeHandler';
|
||||
import { Position } from './motion/position';
|
||||
|
||||
export class TextEditor {
|
||||
static async insert(text: string): Promise<boolean> {
|
||||
static async insert(text: string, at: Position = undefined): Promise<boolean> {
|
||||
if (at) {
|
||||
vscode.window.activeTextEditor.selection = new vscode.Selection(at, at);
|
||||
}
|
||||
|
||||
if (ModeHandler.IsTesting) {
|
||||
return vscode.window.activeTextEditor.edit(editBuilder => {
|
||||
editBuilder.insert(vscode.window.activeTextEditor.selection.active, text);
|
||||
|
@ -10,6 +10,7 @@ suite("Mode Normal", () => {
|
||||
|
||||
let {
|
||||
newTest,
|
||||
newTestOnly
|
||||
} = getTestingFunctions(modeHandler);
|
||||
|
||||
setup(async () => {
|
||||
@ -560,4 +561,18 @@ suite("Mode Normal", () => {
|
||||
keysPressed: '2gg',
|
||||
end: ['one', '|two', 'three']
|
||||
});
|
||||
|
||||
newTest({
|
||||
title: "Can handle dot with A",
|
||||
start: ['|one', 'two', 'three'],
|
||||
keysPressed: 'A!<esc>j.j.',
|
||||
end: ['one!', 'two!', 'three|!']
|
||||
});
|
||||
|
||||
newTest({
|
||||
title: "Can handle dot with I",
|
||||
start: ['on|e', 'two', 'three'],
|
||||
keysPressed: 'I!<esc>j.j.',
|
||||
end: ['!one', '!two', '|!three']
|
||||
});
|
||||
});
|
@ -197,6 +197,15 @@ async function testIt(modeHandler: ModeHandler, testObj: ITestObject): Promise<v
|
||||
//
|
||||
let actualPosition = Position.FromVSCodePosition(TextEditor.getSelection().start);
|
||||
let expectedPosition = helper.endPosition;
|
||||
|
||||
/*
|
||||
if (actualPosition.line !== expectedPosition.line ||
|
||||
actualPosition.character !== expectedPosition.character) {
|
||||
|
||||
debugger;
|
||||
}
|
||||
*/
|
||||
|
||||
assert.equal(actualPosition.line, expectedPosition.line, "Cursor LINE position is wrong.");
|
||||
assert.equal(actualPosition.character, expectedPosition.character, "Cursor CHARACTER position is wrong.");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user