Skip to content

Commit

Permalink
Revert PR VSCodeVim#1303?
Browse files Browse the repository at this point in the history
  • Loading branch information
Chillee committed Apr 24, 2017
1 parent c672023 commit 8228200
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
5 changes: 1 addition & 4 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2199,16 +2199,13 @@ export class ChangeOperator extends BaseOperator {

public async run(vimState: VimState, start: Position, end: Position): Promise<VimState> {
const isEndOfLine = end.character === end.getLineEnd().character;
const isBeginning =
end.isLineBeginning() &&
!start.isLineBeginning(); // to ensure this is a selection and not e.g. and s command
let state = vimState;

// If we delete to EOL, the block cursor would end on the final character,
// which means the insert cursor would be one to the left of the end of
// the line. We do want to run delete if it is a multiline change though ex. c}
if (Position.getLineLength(TextEditor.getLineAt(start).lineNumber) !== 0 || (end.line !== start.line)) {
if (isEndOfLine || isBeginning) {
if (isEndOfLine) {
state = await new DeleteOperator(this.multicursorIndex).run(vimState, start, end.getLeftThroughLineBreaks());
} else {
state = await new DeleteOperator(this.multicursorIndex).run(vimState, start, end);
Expand Down
8 changes: 0 additions & 8 deletions test/mode/modeVisual.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -640,14 +640,6 @@ suite("Mode Visual", () => {
endMode: ModeName.Normal
});

newTest({
title: "Changes on a firstline selection will not delete first character",
start: ["test|jojo", "haha"],
keysPressed: "vj0c",
end: ["test|haha"],
endMode: ModeName.Insert
});

suite("D command will remove all selected lines", () => {
newTest({
title: "D deletes all selected lines",
Expand Down

0 comments on commit 8228200

Please sign in to comment.