termux / termux-app

Termux - a terminal emulator application for Android OS extendible by variety of packages.
https://f-droid.org/en/packages/com.termux
Other
31.27k stars 3.32k forks source link

CTRL + space bar should become CTRL-@ #3896

Open natebragg opened 1 month ago

natebragg commented 1 month ago

According to showkey -a, some keys are not registered or don't have the same output as a desktop terminal (both a bare console and XTerm).

When CTRL+2 is pressed, the output is:

^@        0 0000 0x00

This is the correct behavior.

When CTRL+@ (CTRL+shift+2) is pressed, the output is:

@        64 0100 0x40

This is not correct, it should be the same as CTRL+2 (this is the same behavior as other CTRL+shift+num, which are all incorrect).

CTRL+space is not registered by the terminal (i.e.,nothing is printed). This is also not correct, it should have the same output as CTRL+2.

I use these keys frequently, so pretty please support it.

ErrrorMaxx commented 1 month ago

For me: Ctrl+Space sends ^@ Ctrl+@ and Ctrl+Shift+2 sends @ Ctrl+2 sends nothing

natebragg commented 1 month ago

If it makes a difference, I'm typing this on a physical keyboard. Is there a way to collect logs for this that I can post here?

Grimler91 commented 1 month ago

Pretty sure this will depend on the layout of your physical keyboard, and the selected language/layout of the keyboard in android settings. What type of keyboard are you using?

Is there a way to collect logs for this that I can post here?

You can get more information about keys and how termux interprets them through long press -> settings -> Termux -> Debugging -> Terminal View Key Logging. Then run logcat in a separate terminal (preferably in an SSH shell from another machine to decrease noise)

natebragg commented 1 month ago

After much messing around, I have learned two things. I compared the device with this issue (Meta Quest 3) with my phone (Pixel 8). CTRL+space works on the pixel, but fails on the Quest. On the Quest for some reason numlock is set (my keyboard has no numpad or numlock key). The output of CTRL+2 vs CTRL+@ is opposite between the two (CTRL+2 => ^@ on the Quest, but 2 on the Pixel). The big difference though is that the Quest requires setting ctrl-space-workaround in termux.properties.

In light of that, I'd ask two things with this ticket: 1) if there are system-wide device specific settings for ctrl-space-workaround, please add the Quest to that list. 2) CTRL+2 and CTRL+@ should behave the same, and both produce ^@