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

Stop comma from switching the find direction #4314

Merged
merged 1 commit into from
Dec 1, 2019
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
14 changes: 11 additions & 3 deletions src/actions/motion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -700,9 +700,17 @@ class MoveRepeatReversed extends BaseMovement {
vimState: VimState,
count: number
): Promise<Position | IMovement> {
const movement = vimState.lastCommaRepeatableMovement;
if (movement) {
return movement.execActionWithCount(position, vimState, count);
const semiColonMovement = vimState.lastSemicolonRepeatableMovement;
const commaMovement = vimState.lastCommaRepeatableMovement;
if (commaMovement) {
const result = commaMovement.execActionWithCount(position, vimState, count);

// Make sure these don't change. Otherwise, comma's direction flips back
// and forth when done repeatedly. This is a bit hacky, so feel free to refactor.
vimState.lastSemicolonRepeatableMovement = semiColonMovement;
vimState.lastCommaRepeatableMovement = commaMovement;

return result;
}
return position;
}
Expand Down
8 changes: 8 additions & 0 deletions test/mode/normalModeTests/motions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,14 @@ suite('Motions in Normal Mode', () => {
end: ['te|xt text'],
});

// See #4313
newTest({
title: "Can handle 'f' and multiple back searches",
start: ['|a a a a a'],
keysPressed: 'fa;;;,,,',
end: ['a |a a a a'],
});

newTest({
title: "Can handle 't'",
start: ['text tex|t'],
Expand Down