-
-
Notifications
You must be signed in to change notification settings - Fork 572
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
Add skippable typings #774
Conversation
After using it on different |
I like the idea of skipping the animation, but I would prefer the API method for this. |
I have now added Works like a charm for me. |
I don't think that skip needs a counter. The developer can easily not call animation if he wants, the developer control when he invokes the animation so he can skip animation in the middle on user request and don't invoke future animation. So count is redundant. I also don't like having const options = {
keymap: {
ENTER: function(e, original) {
if (this.animating()) {
this.skip();
} else {
original();
}
}
}
}; there only need to be an API to check if terminal is animating. |
Another useful thing that can be added is animation events.
this will also allow you to have what you want. let skip_count = -1;
const options = {
keymap: {
ENTER: function(e, original) {
if (this.animating()) {
this.skip();
skip_count = 10;
} else {
original();
}
}
},
onAnimationStart() {
if (--skip_count < 0) {
return false;
}
}
}; |
In terms of the skipKey I think your variant would be great, but I think the keymap is being blocked at line 8819:
So the terminal doesn't respond to any key events. I just tested it and your code only works if you remove the animating blocker. (Or am I missing something?)
|
I agree that |
I removed multi-skip. |
About your concern that animation disables all user-defined key events, I would just refactor how key down is implemented and allow calling user-defined functions but don't do default action, I'm yet not sure how. I need to look at the code. About the PR, please remove
that just returns $(document).keydown(e => {
if (term.animating() && e.which == 13) {
term.skip();
}
}); Later I would figure out how to make the keymap work with the current API when the animation is running. But for now, it will work and there would be no odd options. |
Sounds like a plan, I removed the Actually Very strange. It's technically a bug, but I don't think it's really worth changing. |
I've already merged but I will change the API. skip can work as a toggle, no need for two methods. |
This makes typing animations skippable by hitting enter while they are running.
I selected
enter because of convenienceandkeyup
in order to not interfere with other bindings. However, if you see another, better fitting/cleaner binding it should be easy to switch it. (I thought ofdblclick
for minimal interference as well, but its a bit too inconvenient imho)I initially worked on master, without the masking fix #770 . In the "skipping" case this might still be a problem.