Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
ace: add external keyboard support on iOS (except history) #3172
This adds some basic external keyboard handling and fixes part of #37 .
What is supported:
What is not supported:
However, this provides a pretty usable experience.
How does it work?
The only event that iOS sends to textareas and other editable elements when any "special" character is pressed is
It is possible to modify the code to also support history and touch, but I'll leave it for another PR :)
referenced this pull request
Dec 20, 2016
This looks awesome!
I only found a couple of small issues:
Thanks @nightwing :)
Ok, so this works by: 1) using a specific placeholder to detect special keys and 2) resetting the selection after every selectionchange event that has been handled. I don't know why this approach didn't work before though...
Anyway, for the sake of explanation, let's make an example:
the hidden textarea contains:
Needing to attach it to the
Thanks for discovering the fast typing bug :) I think the reason is that I reset
Unfortunately I don't have time to keep working on this, sorry for the inconvenience. It was meant as a simple proof of concept and as someone stated in a different bug report, it might cause problems with other plugins (like
@aaronvegh thanks for checking! I didn't yet buy iPad because of this. Also, some offtopic, did you by any chance use your ipad with keyboard for coding in terminal vim as ide or something? Very interested in experience. If you even have video of this process somewhere public, would be very interested to see.
@nightwing: you now put me in a hard situation... Should I do like Fermat, so that I have at least something in common with him, or should I answer your question and lose this great chance? :)
I'm writing from my phone right now, so I can't elaborate a lot, I'll be more precise tomorrow. To make history work, it should be enough to track when the content of the hidden textbox changes without any other event has been detected (keypress, copy/paste etc). This should be pretty easy to do for Cmd+Z (undo), less so for Cmd+Shift+Z (redo).
I'll try to recollect my original thoughs and elaborate more on this tomorrow :) right now I don't remember anything on how to make touch selection work too.
More details on history support:
This would be my plan, but again, it depends on the possibility of making programmatic changes to a textarea preserving/changing its history.