-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fixes #8975 The literal string "<leader>" is substituted for the leader key when repeating a command-line command #9075
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
Conversation
… the leader key when repeating a command-line command
Can you please write a test case for this? |
I don't know how to write test cases. Do you have any documentation for reference? |
I think the test will be similar to this one: Lines 25 to 30 in cfbd076
To test for my issue, you'll need two such testcases. One where leader is My guess is that you'll have to use the configuration to set the leader key before starting the test, see https://github.com/VSCodeVim/Vim/blob/master/src/configuration/configuration.ts I'm not sure if for the test to simulate those key presses, the Either way I would first check that it fails the test before your change, and then confirm that it passes after your change. |
I think you have to write |
@mvandenhoek @J-Fields After restoring the code Vim/src/state/recordedState.ts Lines 58 to 59 in 5365305
and adding the following test code suite('`:` (command) register used as macro and command with leader key', () => {
setup(async () => {
const configuration = new testConfiguration.Configuration();
// for testing with <leader>
configuration.leader = 'o';
await setupWorkspace(configuration);
});
newTest({
title: 'Repeat :s and command with leader key',
start: ['|old', 'old', 'old'],
keysPressed: ':s/old/new\nj@:j@@',
end: ['new', 'new', '|new'],
});
newTest({
title: 'Repeat :s and command with leader key',
start: ['|old', 'old', 'old'],
keysPressed: ':s/old/new\nj@:j@@',
end: ['new', 'old', '|old'],
statusBar: 'E486: Pattern not found: <leader>ld',
});
}); The running result is as follows
it fails the test Then modify the code - result = this.commandList.join('');
+ return this.commandList.join(''); The running result is as follows
I think this should prove that I solved this bug and did not damage the original functionality |
I think that if
Then I think that solves the issue. So if it didn't break anything else I would approve of it. I was also trying to run the tests myself, and I could run it locally with |
I think the existing test cases are all used
newTest -> newTestOnly |
Co-authored-by: Michel <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but my knowledge of the internal workings of the vscodevim plugin is limited, so there should also be another reviewer.
Thank you! |
What this PR does / why we need it:
fixes #8975 The literal string "" is substituted for the leader key when repeating a command-line command
Which issue(s) this PR fixes
#8975
Special notes for your reviewer:
The commandList here saves the ex command, which typically do not include leader.
Vim/src/state/recordedState.ts
Lines 58 to 59 in 5365305
Therefore, we do not need the following replace
Vim/src/state/recordedState.ts
Lines 62 to 64 in 5365305