replete-android icon indicating copy to clipboard operation
replete-android copied to clipboard

Auto-eval if enter pressed at end of text entry

Open mfikes opened this issue 6 years ago • 2 comments

Fixes #42

mfikes avatar May 18 '19 13:05 mfikes

Hey @roman01la, while this fixes the issue, one scenario that it doesn't handle really well is the case when the VM is still initializing and the user, say, quickly types a simple form like 1 and then hits enter.

In that case, it will not be able to eval so it punts and just lets a return go through. Ideally it would block at that point until eval is possible and then do the eval, but it wasn't clear to me how to achieve that cleanly. I tried adding a busy polling loop in the code at that point to wait, but that just locks up the UI.

By the way, on the iOS side, I only realized recently that it is possible to "jump the gun" in this situation, and I've logged https://github.com/replete-repl/replete-ios/issues/136 and will try to make it block there, but if not, I might just do the same as in this ticket.

mfikes avatar May 18 '19 13:05 mfikes

@roman01la A demo of what it looks like to block on an iPad 2 (which is the oldest / slowest device I have) is over here https://github.com/replete-repl/replete-ios/pull/137#issuecomment-493694037

(IMHO, blocking is not so bad, even on such an old device which is the most likely to exhibit any blocking).

Of course, this PR doesn't introduce blocking; just illustrating what it would look like if we created a revised approach that does involve blocking on Android.

mfikes avatar May 18 '19 17:05 mfikes