-
Notifications
You must be signed in to change notification settings - Fork 35
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
Support text paste on iOS #653
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
left explanation inline
// pressing V first and then cmd, but it is good enough to filter out | ||
// the majority of the noisy behavior since typically you press cmd first. | ||
if (keyCode === LEFT_META_HID_CODE || keyCode === RIGHT_META_HID_CODE) { | ||
this.pressingMetaKeys += direction === "Down" ? 1 : -1; |
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.
This is not a good approach as it assumes that meatKey "up" event is going to happen, but if it won't it will brak the v key forever.
How to reproduce a problem:
- Click
cmd
with Simulator focused - still holding
cmd
key click on something outside the ide and the release thecmd
key - the
v
key is now unusable
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.
Doesn't the described scenario break all the keys though? In this case the simulator would think that the meta key is pressed the whole time so other keys shouldn't be interactive as well. I don't think fixing this is within the scope of this PR
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.
you are correct that this is a larger problem, but in the more general example the keyboard recovers after pressing and releasing cmd
key, but this solution introduces a new bug that in this scenario disables exclusively the v
key
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 updated the code to use bool flags instead of the counter, so now you'll be able to recover from this issue by pressing meta key again
…ple release meta keys after focusing away from the IDE panel
This PR adds text paste support on iOS.
For Android, we use simulator-server to pass paste command. On iOS that was tricky to do and since there's a simctl command for paste we can use that instead.
In this change, we are overriding the sendPaste implementation for iOS that uses simctl pbcopy command that expects the pasted text to be sent via standard input.
In addition, we disable sending cmd+v key combination as HID keys to the simulator. It turned out to result in a buggy behavior when sometimes the key combination would trigger paste action and actually paste text into a focused text input, while most of the times it'd just do nothing. There were also instances where the previous text was pasted instead. Blocking this behavior isn't ideal but it puts iOS functionality in pair with Android while also avoiding a number of issues. It appears like the bugs are not caused by the IDE since we also observe these when testing paste functionality with the standard iOS simulator app.
Closes: #553
How Has This Been Tested: