Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: search backwards with operator #5041

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/actions/commands/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1204,13 +1204,6 @@ export class CommandSearchBackwards extends BaseCommand {
isMotion = true;
isJump = true;

public doesActionApply(vimState: VimState, keysPressed: string[]): boolean {
// Prevent collision with `g?` (rot13 operator)
return (
super.doesActionApply(vimState, keysPressed) && vimState.recordedState.operator === undefined
);
}

public async exec(position: Position, vimState: VimState): Promise<VimState> {
globalState.searchState = new SearchState(
SearchDirection.Backward,
Expand Down
16 changes: 16 additions & 0 deletions test/mode/modeNormal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2375,6 +2375,22 @@ suite('Mode Normal', () => {
endMode: Mode.Normal,
});

newTest({
title: 'Can delete with search forward',
start: ['foo |junk junk bar'],
keysPressed: 'd/bar\n',
end: ['foo |bar'],
endMode: Mode.Normal,
});

newTest({
title: 'Can delete with search backward',
start: ['foo junk garbage trash |bar'],
keysPressed: 'd?junk\n',
end: ['foo |bar'],
endMode: Mode.Normal,
});

newTest({
title: 'Can do C',
start: ['export const options = {', '|', '};'],
Expand Down