terrychou / iVim

A vim port to iOS.
598 stars 35 forks source link

Keyboard issues when entering password for encrypted files #181

Closed jdschroeder closed 3 years ago

jdschroeder commented 3 years ago

I have a handful of files that are encrypted using Vim's built-in blowfish2 encryption. In iVim I find a few keyboard oddities when entering the password to open these files.

First, when the password prompt appears, there are already six characters that need to be deleted before I can enter the document password.

On both my iPhone XR and 4th generation iPad Air, the keys of the on screen keyboard remain in their active state after they have been pressed.

Keys stuck in active state on iPhone XR

Keys stuck in active state on iPad Air

When the iPad is attached to the Magic Keyboard, the password entry doesn't work at all. It appears that the document is opened without decrypting and the password string is then passed in. In this example, I used the password "password", and you can see that after an 'a' that would put us in Insert mode, the remainder of the password is inserted into the document and left me in Insert mode.

IMG_0008

Detaching from the Magic Keyboard, the password can then be entered successfully.

These are all minor issues; they don't prevent me from opening or editing these files.

terrychou commented 3 years ago

What are the versions of iOS on your iPhone and iPad?

When an external keyboard is attached, the letter keys are also handled specifically for enabling the key repeating feature. Please try disable this in iVim's settings (:isettings) to see whether it helps.

Would you please give me a similar file in question and the steps to re-produce your issue, so that I can test it on my end?

jdschroeder commented 3 years ago

iOS 14.2 on the iPhone and iPadOS 14.1 on the iPad.

Turning off key repeating does indeed fix the issue with the Magic Keyboard not working.

Here is a file encrypted with blowfish2. The password is simply password

password-protected.txt

Save that into a folder accessible in the Files app, and then open using :idoc. When entering the password using the on-screen keyboard you should see the pre-filled password characters and persistent keys issue. I have previously only opened these documents via :idoc; it appears that these issues do not appear when using :e to open the file from within the iVim files.

jdschroeder commented 3 years ago

Just tested with iPadOS 14.2, and the pre-filled password characters and on-screen keyboard persistent key issues remain with that version as well.

terrychou commented 3 years ago

I have fixed this by taking over the key inputting and providing an alert instead for external encrypted files. Moreover, the encrypted files are now taken care of for auto-restore too. This is included in version 2.27(1), which should be available soon.

jdschroeder commented 3 years ago

Thanks @terrychou. This works great in the latest update!