neovim-qt icon indicating copy to clipboard operation
neovim-qt copied to clipboard

<S-BS> and <S-Space> no longer reporting "Shift"

Open ltratt opened this issue 2 years ago • 11 comments

On 7b230767dd04d921ca5c2c31ad46ffd00111aed2:

$ cat /tmp/conf.lua
vim.api.nvim_set_keymap('i', '<BS>', 'hello', {noremap=true})
vim.api.nvim_set_keymap('i', '<S-BS>', 'goodbye', {noremap=true})
$ nvim-qt -- -u /tmp/conf.lua

Pressing either "backspace" or "shift-backspace" in insert mode inserts the text "hello" but never the text "goodbye". These key bindings worked as expected on neovim-qt-0.2.16.1.

ltratt avatar Jul 07 '22 10:07 ltratt

Based on bisection, it seems to be due to 4352846be7f7f42738c568eafaba965a20bb7a45 https://github.com/equalsraf/neovim-qt/issues/259 - where the shift modifier was removed from space/backspace because it was causing another issue.

equalsraf avatar Jul 07 '22 22:07 equalsraf

Ah so it seems that in :terminal mode Shift-Backspace was a problem but, AFAICS, no-one had an issue with it in non-:terminal mode? Does that mean the input.cpp needs a check along the lines of if (api2->nvim_get_mode() == "terminal") around the if (key == Qt::Key_Backspace) bit?

ltratt avatar Jul 08 '22 07:07 ltratt

@ltratt

I think the key sequence we sent in previous versions was a bug. As I understand, <S-Backspace> should not be sent by the input layer.

Do your <S-BS> mappings work in nvim?

From a quick test with my machine, nvim also triggers a <BS> event when Shift + Backspace keys are pressed.

jgehrig avatar Jul 08 '22 07:07 jgehrig

Yes, <S-BS> works in plain nvim (assuming the terminal supports it: xterm supports it but xfce4-terminal doesn't, for example).

ltratt avatar Jul 08 '22 07:07 ltratt

Oops I forgot to explicitly mention you @jgehrig

ltratt avatar Jul 14 '22 14:07 ltratt

@ltratt Thanks for the reminder ping!

I'm a little hesitant to add the :terminal mode check to the input layer. I've tried to keep the input layer stateless, so it is easier to validate and test.

I will do some investigation and report back.

jgehrig avatar Jul 15 '22 21:07 jgehrig

@ltratt

I don't think there is a practical way for us to fix this... More details added to the upstream Neovim bug.

The check you suggested requires and RPC request/response before every key event. This would be a big performance hit.

A reasonable argument can the made the issue here is how Neovim handles <S- modifiers in terminal mode.

jgehrig avatar Aug 02 '22 03:08 jgehrig

Just installed v0.2.17, this seems to have broken my <S-Space> binding, even though it only affected backspace? I'm confused.

The check you suggested requires and RPC request/response before every key event. This would be a big performance hit.

Can we configure this based on a buffer variable, and then set that variable on all terminal buffers? My main use case is getting my <S-Space> binding back, I personally accept producing weird characters on terminal buffers, or setting this on the default configuration.

simaoafonso-pwt avatar Aug 03 '22 10:08 simaoafonso-pwt

@simaoafonso-pwt

Sorry for the scenario regression!

Hopefully we can land on a reasonable solution that fixes both <S-Space>, <S-BS>, and the character sequences in terminal mode...

I'm confused.

The terminal mode issues were with both <S-Space> and <S-BS>. I've updated the title to make this more clear. We removed the <S- modifier from these key sequences because they do not work in terminal mode and many users have complained.

I personally accept producing weird characters on terminal buffers, or setting https://github.com/equalsraf/neovim-qt/issues/259#issuecomment-475829115 on the default configuration.

Unfortunately, other users feel exactly the opposite: I'm getting pulled in two directions on this issue :)

jgehrig avatar Aug 03 '22 16:08 jgehrig

The terminal mode issues were with both <S-Space> and <S-BS>. I've updated the title to make this more clear. We removed the <S- modifier from these key sequences because they do not work in terminal mode and many users have complained.

According to 4352846be7f7f42738c568eafaba965a20bb7a45, Shift was already removed for <S-Space>, and this commit also does it for <S-BS>. My confusion was how did this work before?

Sorry for the scenario regression!

Unfortunately, other users feel exactly the opposite: I'm getting pulled in two directions on this issue :)

Hopefully there will be workarounds for both sets of people. No hard feelings.

simaoafonso-pwt avatar Aug 03 '22 18:08 simaoafonso-pwt

There was a second commit, here is the 'breaking' Pull Request: https://github.com/equalsraf/neovim-qt/pull/729

Hopefully there will be workarounds for both sets of people. No hard feelings.

Yes, hopefully we can figure out a solution that works for both sides of this issue!

I'm waiting for a response from Neovim about terminal mode detection, and what options are available.

jgehrig avatar Aug 03 '22 18:08 jgehrig

What's the status of this?

Is it blocked on https://github.com/neovim/neovim/issues/20325?

simaoafonso-pwt avatar Jan 23 '23 18:01 simaoafonso-pwt

While I don't like the keymap workaround, and I believe this is an issue Neovim should fix upstream... I'm going to apply the runtime key remap fix.

There is no movement from Neovim, and this is blocking users. We do have the ability to fix this with a solution that should work for everyone.

Please let me know if see any issues with this Pull Request: https://github.com/equalsraf/neovim-qt/pull/1049

jgehrig avatar Feb 16 '23 21:02 jgehrig