iVim icon indicating copy to clipboard operation
iVim copied to clipboard

Caps Lock to Ctrl mapping not functioning on iPadOS

Open jiahaoLjh opened this issue 5 years ago • 12 comments

I've tried mapping caps lock to both esc and ctrl in Settings. The esc works while ctrl not. Tested on iPadOS 13.1.2 on iPad Pro 2018. I just started to use iVim these two days so I'm not sure whether it is related to the new iPadOS. Anybody experiencing the same issue?

jiahaoLjh avatar Oct 04 '19 13:10 jiahaoLjh

Good catch. I can confirm this behavior using hardware keyboard on both iPad OS 13.1.2 and on iPhone running iOS 13.1.2.

mtwebb avatar Oct 05 '19 16:10 mtwebb

It seems caused by a change of caps lock key handling from the system. And it breaks the way iVim remaps caps lock key.

terrychou avatar Oct 10 '19 03:10 terrychou

Terry, thanks a million for your work on this project.

I am trying to use a Logitech K760 keyboard with an iPhone 7 Plus running iOS 13.3 and iVim 8.1. I am having no luck remapping capslock; whether I try none, esc, or ctrl (my preferred option), capslock doesn't do anything. It doesn't even function as capslock, though the green LED on the key lights up and the capslock works in other apps.

On the other hand, on my iPad mini 2 running 12.4.4, capslock does remap to ctrl, though selecting "none" doesn't enable the normal capslock behavior.

Thoughts?

lignamorren avatar Feb 03 '20 01:02 lignamorren

@lignamorren you're welcome.

As mentioned above, the reason why the caps lock remapping stops working in iOS 13 is that Apple had changed the behavior of caps lock pressing in the updates. As a result, the way iVim "hacks" to do this is broken. There is little I can do about this. However, remapping to esc seems still working in iOS 13.

Selecting "none" should put the caps lock key to its "normal" behavior. For me, it switch among languages of the input.

terrychou avatar Feb 03 '20 03:02 terrychou

@terrychou, I confirm that mapping caps lock to esc works. But selecting none seems to disable the caps lock key altogether. This happens in both iOS 12 and 13.

I'm curious, where's that option to switch between languages? Is that the same as switching keyboards?

While we're discussing input, I'm noticing that whenever I type " , what I get is "". So if I'm not paying attention, trying to type "vim" editor results in "vim""editor. This occurs in iOS 13 but not 12.

lignamorren avatar Feb 03 '20 22:02 lignamorren

@lignamorren I have several keyboards set, by default, pressing caps lock toggle among them.

As to the quotes problem, I don't have it. It probably has something to do with your plugins.

terrychou avatar Feb 04 '20 02:02 terrychou

I see. Turns out Gboard and Emoji don't qualify as keyboards in this sense. I added a keyboard and I see what you're talking about. But after some time fooling around with keyboards and iVim settings, iVim seems to have gotten confused and stopped seeing caps lock at all. The only remedy seems to be to restart the phone. And twice now, I've seen iVim get into a state where it doesn't recognize the 2 key; in insert mode it seems to insert some sort of escape sequence. If it happens again I'll be sure to capture it for you.

I don't have any plugins installed, only the one tweaked color file and a .vimrc that doesn't map anything to " or ' . (Yes, it happens with single quotes and backticks (`) too.)

lignamorren avatar Feb 04 '20 04:02 lignamorren

In the latest iPadOS 13.4 beta it is now possible to remap caps lock on hardware keyboard to escape / contol, at the system level. While the in app hack was nice, it’s great to not have caps lock state carried over when switching out of iVim. Glad to see Apple move in this direction.

mtwebb avatar Mar 01 '20 17:03 mtwebb

@mtwebb maybe that was the reason Apple did the change.

terrychou avatar Mar 02 '20 03:03 terrychou

EDIT: The below issues seem to have been resolved by deleting all of the buffers. Not sure what was going on there...

For some reason, as of the latest iPadOS public beta, I have to hit Shift-Return to get an actual Return. For example, if I want to enter :ls<Return>, I have to type :ls<Shift-Return> - just hitting <Return> does nothing anymore, ever, as far as I can see. I've tried re-pairing the keyboard, etc.

It also appears that the Backspace and Delete keys have stopped working...

Mark

mchalkley avatar Mar 04 '20 13:03 mchalkley

As another follow-up to the above, this continues to occur sporadically. My statement regarding deleting all the buffers resolving it isn't accurate, though - the last few times it happened, I had to quit iVim to get the external keyboard working properly again (in iVim only - testing it in other apps didn't show any issues).

Simply switching to another app seems to cause this to happen. The last couple times, it occurred when I switched to the Messages app on my iPad to respond to a text message. When I returned, the keyboard was malfunctioning as described above. It seems to happen about 10% of the time...

The other peculiarity here is that iVim's cursor changes from a solid block to a hollow block at the same time...

Mark

mchalkley avatar Mar 06 '20 16:03 mchalkley

13.4 has just been released and the ability to control the hardware key mapping has been kept -- no more workarounds are needed. Everything seems to be working beautifully. Thanks for an awesome app!

brettc avatar Mar 25 '20 03:03 brettc