-
Notifications
You must be signed in to change notification settings - Fork 5.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
Key simulation #1850
base: master
Are you sure you want to change the base?
Key simulation #1850
Conversation
Is there something wrong with this PR? Except for the main functionality of key simulation it is attempt to make the key handling a bit more uniform. |
// we don't call the callback as we don't handle a command key here | ||
// (it's a normal key/character input). | ||
// 2014-03-11 rksm: command key == mac cmd? If just cmd is pressed hashId | ||
// will be -1 and callback will be called... please clarify. |
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 think hashId
can't be -1, it's equal to 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
Sorry for the delay with reviewing this. The changes generally look good, but i don't like that this adds code needed only for testing into the main module. |
@rksm Did you need simulateKeys in editor itself or only in tests? I want to move it and it's helpers into separate module. |
I need it as a feature outside of tests but whether it resides in a separate module or not doesn't matter. |
Conflicts: lib/ace/lib/event.js Conflicts: lib/ace/lib/event.js
insertions into editor e.g. keys.simulateKey(editor, 'Right') keys.simulateKey(editor, 'a') keys.simulateKey(editor, 'Command-a') etc
Has the ability to simulate key presses been added in some fashion? Not just content keys, but modifier keys as well and the tab key functionality. To take tab as an example - just inserting a tab works for most occasions, and indenting might be handled as described here: http://stackoverflow.com/questions/24607730/ace-editor-javascript-triggering-a-tab-press-event-for-ace-editors-event-hand/24608974#24608974. Unfortunately, more uses of tab keep popping up. With snippetManager, pressing tab navigates to the next specified text in a snippet and I want that functionality as well. I don't want to have to recreate all the functionality for each plugin I use. I'd like to just simulate an actual key being pressed or held. Is this possible? |
@knod Since this feature seems to be unwanted I ended up publishing it in an extension. |
@knod ace.improved has some doc now, https://github.com/rksm/ace.improved#aceextkeys |
@rksm Thanks, I'll look into that. I have a lot else to work on, but this will become a major issue soon, so I'm glad to see there's a way to handle it out there. |
This implements a simple form of triggering commands and insertions by simulating keys. Like:
todo:
keys.simulateKeys(editor, 'Right Right Command-Down')
)keys.send
/ old vim sendKeys code upon simulateKeys