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

Nothing happens when pressing 'Return' on an item in vim normal mode, on Wayland backend #409

Open
sij1nk opened this issue Jun 23, 2024 · 2 comments

Comments

@sij1nk
Copy link

sij1nk commented Jun 23, 2024

bemenu version: v0.6.20 (also happens on current master, 5bc8a6c)

On the Wayland backend, when I enter vim normal mode, highlight an item, and press 'Return', nothing happens. The 'Return' key in vim insert mode works as expected.

# all other BEMENU_* environment variables are left blank
export BEMENU_BACKEND wayland
echo -e "1\n2\n3" | bemenu --binding vim

However if I use the x11 backend, the 'Return' key also works in vim normal node - the highlighted item is printed to stdout and bemenu exits. I assume this is the intended behavior.

# all other BEMENU_* environment variables are left blank
export BEMENU_BACKEND x11
echo -e "1\n2\n3" | bemenu --binding vim

Can reproduce on sway version 1.9 (default configs), and on a heavily configured Hyprland 0.38, which I daily drive.

@sij1nk
Copy link
Author

sij1nk commented Jun 23, 2024

I looked into this a bit, and logged the key (bm_key), unicode, and code (bm_vim_code) values directly after the bm_vim_key_press call (https://github.com/Cloudef/bemenu/blob/master/lib/menu.c#L1039) for a 'Return' keytap (vim normal node on a highlighted item):

wayland: (default case -> key is consumed -> nothing happens)

bm_key: BM_KEY_RETURN
unicode: 13 (carriage return)
bm_vim_code: BM_VIM_CONSUME

x11: (unicode 0 is immediately ignored -> default action for 'Return' is used)

bm_key: BM_KEY_RETURN
unicode: 0
vim code: BM_VIM_IGNORE

curses: (default case -> key is consumed -> nothing happens)

bm_key: BM_KEY_RETURN
unicode: 10 (line feed)
vim code: BM_VIM_CONSUME

The x11 keysym to unicode mapping in https://github.com/Cloudef/bemenu/blob/master/lib/renderers/x11/xkb_unicode.c confuses me a bit - not sure why the GLFW folks decided not to map XK_Return to anything

The actual bm_key value is consistent across all 3 platforms, but the unicode isn't, so it'd make sense to me to base such logic on bm_key instead. However the 'Return' key isn't explicitly handled in bm_vim_key_press so I'm not sure what the intended behavior really is

@sij1nk
Copy link
Author

sij1nk commented Jun 23, 2024

I hacked around this by doing sij1nk@6dc4af0

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

1 participant