Skip to content
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

Virtual keyboard selects special characters during fast input #11668

Open
tarkeez opened this issue Apr 11, 2024 · 17 comments
Open

Virtual keyboard selects special characters during fast input #11668

tarkeez opened this issue Apr 11, 2024 · 17 comments

Comments

@tarkeez
Copy link

tarkeez commented Apr 11, 2024

  • KOReader version: 2024.03.1
  • Device: Onyx Boox Page (Android 11)

Issue

When typing (e.g. adding a note to a highlight), a sequence of two characters (e.g. n + g) will be interpreted a single special character (e.g. ñ) if they are typed in quick succession.

Steps to reproduce

Open input field
Have latin based keyboard (e.g. English)
Type two letters in quick succession
Occasionally get a single special character instead of the two characters you typed

Possible cause

What sems to happen is that the special character chosen corresponds to the area or relative direction where that special character would be in the pop-up if you long press the base character in question. For n:

image

So n + character to the straight-ish left of n gives ñ, n + character to the upper right of n gives ń, n + straight up gives N etc, you get the point.

So when typing fast, sometimes it seems to trigger the behavior of long pressing + choosing a special character around the base letter.

@hius07
Copy link
Member

hius07 commented Apr 11, 2024

Upper menu Gear - Device - Keyboard - Swipe to input additional characters

@tarkeez
Copy link
Author

tarkeez commented Apr 11, 2024

Nice -- yes that was it.

Now the issue becomes that when quick successive taps are interpreted as swipes (and thus ignored when the settings you mentioned is off), you get nothing.

Can anything be done to accommodate us super speed ultra turbo typers? Like skip the check for swipe completely when that setting is off maybe?

@hius07
Copy link
Member

hius07 commented Apr 11, 2024

quick successive taps are interpreted as swipes

Actually only the first tap is interpreted as swipe and is ignored.
So the idea is, if the setting is off, to handle swipes as taps. Makes sense.

@tarkeez
Copy link
Author

tarkeez commented Apr 11, 2024

Fair enough, I guess the second tap becomes the swipe direction.

But is the only solution here to type slower?

Or can the swipe be disabled entirely (instead of registered but ignored) to allow for very fast typing?

@hius07
Copy link
Member

hius07 commented Apr 11, 2024

Can you try if it is the desired behaviour?

local VirtualKeyboard = require("ui/widget/virtualkeyboard")
local VirtualKey
local n = 1
while true do
    local name, value = debug.getupvalue(VirtualKeyboard.addKeys, n)
    if name == "VirtualKey" then
        VirtualKey = value
        break
    end
    n = n + 1
end
VirtualKey.onSwipeKey = VirtualKey.onTapSelect

Create a file named 2-key-swipe-to-tap.lua containing the above lines, put the file into koreader/patches folder, restart KOReader.
(It doesn't depend on the Swipe to input additional characters setting)

@tarkeez
Copy link
Author

tarkeez commented Apr 11, 2024

This half works.

The first tap is no longer ignored, but the second is, so you only get the first letter.

@hius07
Copy link
Member

hius07 commented Apr 11, 2024

Is it actually a combination "swipe+tap"?
And not just a swipe from one key to another?
I tried to reproduce on my Kindle, with as small interval as I can do, and the second tap was detected. (Double taps are disabled in the settings)

@tarkeez
Copy link
Author

tarkeez commented Apr 11, 2024

I am definitely just tapping the keys. I tried disabling double taps, but I'm getting the same results.

If tap three keys in quick succession I get either 1, 12, or 13, never 123. So maybe my device (boox page) has problems with quick successive taps?

I'll try on another Android device when I get the change and post the results.

Thanks for taking the time.

@offset-torque
Copy link

@hius07

On Libra I tried many times. KOReader caught all of them correctly.
Fastest trial was 4 keys in ~500 ms and still they were all correctly entered.
Looks like some Android weirdness (buffering and merging taps?).

@pazos
Copy link
Member

pazos commented Apr 12, 2024

Looks like some Android weirdness (buffering and merging taps?).

Hopefully it isn't and the issue at hand is relegated to a few broken eink/android devices.

On my phone, with haptic feedback enabled, I'm able to type almost as fast as with the regular android keyboard. Okay, not almost but it seems related to the lack of training and mismatches with the keyboard layout I'm used to in a phone.

@hugleo
Copy link
Contributor

hugleo commented Apr 12, 2024

Looks like some Android weirdness (buffering and merging taps?).

Hopefully it isn't and the issue at hand is relegated to a few broken eink/android devices.

On my phone, with haptic feedback enabled, I'm able to type almost as fast as with the regular android keyboard. Okay, not almost but it seems related to the lack of training and mismatches with the keyboard layout I'm used to in a phone.

It isn't, looks normal in my Onyx Ultra C, also Android 11. Unless of course, you got supernatural fingers.

@ws2bhhh
Copy link

ws2bhhh commented Apr 12, 2024

@tarkeez gboard, zh_cn keyboard has the same problem on eink android phones. I manually setting the Swipe to input sensitivity to low to fix this. Maybe you have a similar setting on your device.

@tarkeez
Copy link
Author

tarkeez commented Apr 14, 2024

I did a quick test now on a regular Android device.

Without patch:
The behavior (either ignoring quick successive taps or giving a special character, depending on whether swipe for special character is on or not) is more difficult to trigger (so in practice would not get in the way as much, maybe at all, depending on your typing speed) -- seems I have to input the two letters quicker than on the e-ink boox page to trigger it.

With patch:
Same behavior as expected. Have to input faster than on the eink device, but the same behavior happens: if the taps are close enough together, the second tap is ignored.

So the e-ink device (@ws2bhhh maybe due to the refresh rate of the device or some device-specific refresh settings, or limitations in the digitizer or the drivers for it, maybe it's just the Page @hugleo) is making the issue more noticeable. Still, the fact that it is "trigger-able" on other devices means maybe there is some room for improvement? In the sense that there is still some time threshold beneath which successive taps are ignored/interpreted as swipes. I can provide logs is anyone is interested in having a crack figuring out if there is a way to allow quicker typing and not recognizing quick taps as swipe or long-press+special character tap or whatever is happening.

@Frenzie
Copy link
Member

Frenzie commented Apr 14, 2024

I'm not sure if it was already mentioned, but there are also various time thresholds you can play with in the menu.

@hugleo
Copy link
Contributor

hugleo commented Apr 14, 2024

Seems fine here.

video_2024-04-14_09-36-42-ezgif com-video-to-gif-converter

@tarkeez
Copy link
Author

tarkeez commented Apr 15, 2024

I'm not sure if it was already mentioned, but there are also various time thresholds you can play with in the menu.

Thanks. "Tap interval" and "Tap interval on keyboard" settings seem most relevant, and they default to 0 ms. Double tap lower limit is 100 ms, doesn't seem to make a difference.

I tried typing on the regular system kb on the boox page (I only type longer flowing notes in koreader as book annotations), and it does miss some taps, so there is definitely something making this device (and probably other e-ink low refresh devices) worse than a regular phone/android device. Still, the problem is made worse/is more consistent in koreader.

The Page is small enough to dual thumb "phone type" on which allows for quick typing, but alas.

@Frenzie
Copy link
Member

Frenzie commented Apr 15, 2024

Double tap is only relevant if you enable double tap. Which I wouldn't because it makes everything slower. Some people don't seem to care but I have this feeling… ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants