Added FeatureRequest #1305. Added Tests for new Feature C in Visual Mode

This commit is contained in:
Nicolas Antor 2017-02-16 16:58:18 +09:00
parent 10a952b41c
commit a2aa065a58
2 changed files with 30 additions and 0 deletions

View File

@ -4990,6 +4990,18 @@ class ActionDeleteLineVisualMode extends BaseCommand {
}
}
@RegisterAction
class ActionChangeLineVisualMode extends BaseCommand {
modes = [ModeName.Visual, ModeName.VisualLine];
keys = ["C"];
public async exec(position: Position, vimState: VimState): Promise<VimState> {
return await new ChangeOperator(this.multicursorIndex).run(vimState,
vimState.lastVisualSelectionStart.getLineBegin(),
vimState.lastVisualSelectionEnd.getLineEnd());
}
}
@RegisterAction
class ActionChangeChar extends BaseCommand {
modes = [ModeName.Normal];

View File

@ -683,4 +683,22 @@ suite("Mode Visual", () => {
endMode: ModeName.Normal
});
});
suite("C will replace all selected lines", () => {
newTest({
title: "C replaces all selected lines",
start: ["first line", "test| line1", "test line2", "second line"],
keysPressed: "vjC",
end: ["first line", "|", "second line"],
endMode: ModeName.Insert
});
newTest({
title: "C replaces the current line",
start: ["first line", "test| line1", "second line"],
keysPressed: "vlllC",
end: ["first line", "|", "second line"],
endMode: ModeName.Insert
});
});
});