replete-repl / replete-ios

ClojureScript REPL iOS app
Eclipse Public License 1.0
395 stars 25 forks source link

BUG: Double space adds a full stop #99

Open dotemacs opened 7 years ago

dotemacs commented 7 years ago

How to reproduce:

  1. Start Replete
  2. Enter a '(' (which will then automatically add the second closing ')')
  3. Press spacebar two times
  4. full stop added
dotemacs commented 7 years ago

But if you press delete two times, to delete the full stop, you can then press the space bar as many times as you wish and full stop won't be added again.

Then go in a delete all the whitespace you've just added and the parenthesis. Insert a new parenthesis and the bug can be replicated again.

mfikes commented 7 years ago

@dotemacs This issue had been reported and fixed previously ( #78 ).

Perhaps it regressed with the change to Swift 3 and subtleties surrounding string handling? Or perhaps it is an issue that occurs in the simulator but not on the device?

(I haven't investigated either.)

dotemacs commented 7 years ago

Hello @mfikes

In Swift 3 there has been a change to the way substrings are manipulated, so it made this:

https://github.com/mfikes/replete/blob/33415a4780105b6b138867f0137a6a979fe97034/Replete/ReplViewController.swift#L210

a bit more complicated:

https://github.com/mfikes/replete/blob/e3eb2797e95bc07deafeacf1c5a10d4bfff9d90e/Replete/ReplViewController.swift#L210

But looking at the app version 1.6 on iOS 10.2, entering:

Keys typed Values shown
( SPACE SPACE (. )

Looking at what's currently in the master https://github.com/mfikes/replete/commit/de8c5ca69c41845b03092d2986539c3245f1b753

Keys typed Values shown
( SPACE SPACE (. )

But if you delete the full stop, then you can keep entering SPACE as much as you want, the double space doesn't add the full stop, on that line.

mfikes commented 7 years ago

Interestingly, I can't reproduce the problem with the released version 1.6 on iOS 10.2 (I also have the "." shortcut enabled in my keyboard.) Hrm.

dotemacs commented 7 years ago

Ah! I was using Gboard keyboard

https://appsto.re/gb/syGebb.i

version 1.2.3.6281.

Using Apple's stock keyboard, the bug is not there. Good that we got that cleared up :)

So it look like the regression is only present in the master & in the simulator. I'll try the app from the master on the phone & see how it acts there...