-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Make <delete> repeatable in Normal Mode. Fix #394 #514
Conversation
BTW, there are a few unrelated tests failing, but they also fail on the master branch without my changes. So I ignored them. |
@@ -1960,6 +1960,11 @@ class ActionDeleteChar extends BaseCommand { | |||
} | |||
|
|||
@RegisterAction | |||
class ActionDeleteCharWithDeleteKey extends ActionDeleteChar { | |||
keys = ["<delete>"]; | |||
} |
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.
There is a difference between delete and x is the way they handle numeric prefix. Nx
will perform x
N times but N<Del>
does nothing.
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.
I thought N<Del>
to delete the next 5 chars should be the expected behavior.
So, in Normal Mode, is this
<Del>
-> removes next char
N<Del>
-> do nothing
what I should do instead?
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.
Yup, that's Vim's behavior and it's awkward, but let's do this.
@@ -61,13 +68,20 @@ suite("Mode Normal", () => { | |||
}); | |||
|
|||
newTest({ | |||
title: "Can handle x at end of line", | |||
title: "Can handle 'x' at end of line", | |||
start: ['one tw|o'], | |||
keysPressed: '^llxxxxxxxxx', | |||
end: ['|'], | |||
}); | |||
|
|||
newTest({ |
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.
Also add a case for N<delete>
as the behavior is strange in Vim.
Fix up my one suggestion and we should be good to go here! Thanks for the PR, @octref! |
Ah, I'm sorry for doing this retroactively, but you caught us in the middle of a refactor. Would you mind fixing this up by making both delete classes extend from an abstract base class rather than using inheritance? I'm trying to move away from big inheritance trees; see #519. |
No worries. Refactoring is good. On Tue, Jul 26, 2016 at 10:21 AM, Grant Mathews notifications@github.com
|
@johnfn |
LGTM. Thanks, @octref! |
Yay! We love PRs! 🎊
Please include a description of your change & check your PR against this list, thanks:
gulp tslint
)Previously
<delete>
key works in Normal Mode but is not repeatable.This PR makes it repeatable, so commands like
5<delete>
would work like5x
.