I’m writing a package that needs a single character of input - enter a character and it extends the current selection/selections to the next instance of the given character. It is designed to be a quick editing command and I don’t want the user to have to press Enter, etc.
So far I’ve cobbled something together by studying Find and Replace and trial and error. I have a mini-editor and capture keydown and everything works for normal letters. When I press comma, however, I get keyCode 188, not 44 like I would expect. This is the Unicode 1/4 character and not a comma.
So I guess the best way to ask this is in this order:
- Is there a better way to get a single character input?
- Is there a better event than keydown? content-modified has a long delay for this kind of command
- If I do need to use keyDown, any way to get the correct keys?