Select inner vi( fix (#1175)

* fixes #1165

* fix indenting in test
This commit is contained in:
Sean Kelly 2016-12-18 14:52:30 -08:00 committed by Grant Mathews
parent 2e4de2253a
commit cb9a693104
2 changed files with 10 additions and 2 deletions

View File

@ -5335,13 +5335,13 @@ abstract class MoveInsideCharacter extends BaseMovement {
} else {
startPos = startPlusOne;
if (vimState.currentMode === ModeName.Visual) {
endPos = endPos.getLeft();
endPos = endPos.getLeftThroughLineBreaks();
}
}
// If the closing character is the first on the line, don't swallow it.
if (!this.includeSurrounding) {
if (endPos.character === 0) {
if (endPos.character === 0 && vimState.currentMode !== ModeName.Visual) {
endPos = endPos.getLeftThroughLineBreaks();
} else if (/^\s+$/.test(TextEditor.getText(new vscode.Range(endPos.getLineBegin(), endPos.getLeft())))) {
endPos = endPos.getPreviousLineBegin().getLineEnd();

View File

@ -574,6 +574,14 @@ suite("Mode Visual", () => {
endMode: ModeName.Normal
});
newTest({
title: "Can do vi( on a matching bracket near first character",
start: ["test(()=>{", "|", "});"],
keysPressed: "vi(d",
end: ["test(|);"],
endMode: ModeName.Normal
});
suite("handles replace in visual mode", () => {
newTest({
title: "Can do a single line replace",