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

fish should silently ignore unmapped keys during startup #4431

Closed
mqudsi opened this Issue Sep 27, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@mqudsi
Copy link
Contributor

mqudsi commented Sep 27, 2017

If fish is configured to use a certain key bindings that are available under the usual $TERM but is started under a different $TERM, it will spew that output to the terminal.

For example, I normally use fish almost exclusively under xterm-256color, but sometimes the shell is spawned from a script or similar and I run into this:

mqudsi@ZBook ~> ssh mqudsi@192.168.1.103 'true'
bind: Key with name 'right' does not have any mapping
bind: Key with name 'ppage' does not have any mapping
bind: Key with name 'npage' does not have any mapping
bind: Key with name 'btab' does not have any mapping
bind: Key with name 'up' does not have any mapping
bind: Key with name 'f1' does not have any mapping
bind: Key with name 'right' does not have any mapping
bind: Key with name 'dc' does not have any mapping

By checking what that script configuration sets $TERM to, I can see that it's set to su:

mqudsi@ZBook ~> ssh mqudsi@192.168.1.103 'env'
bind: Key with name 'right' does not have any mapping
bind: Key with name 'ppage' does not have any mapping
bind: Key with name 'npage' does not have any mapping
bind: Key with name 'btab' does not have any mapping
AUTOJUMP_ERROR_PATH=/usr/home/mqudsi/.local/share/autojump/errors.log
AUTOJUMP_SOURCED=1
BLOCKSIZE=K
GOPATH=/usr/home/mqudsi/go
HOME=/home/mqudsi
LC_CTYPE=en_US.UTF-8
LOGNAME=mqudsi
MAIL=/var/mail/mqudsi
OSTYPE=freebsd11.0
PATH=/usr/home/mqudsi/.autojump/bin:/home/mqudsi/.cargo/bin:/usr/home/mqudsi/.config/nvim/dein/repos/github.com/junegunn/fzf/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/mqudsi/bin
PWD=/usr/home/mqudsi
SHELL=/usr/local/bin/fish
SHLVL=1
SSH_CLIENT=192.168.2.6 63814 22
SSH_CONNECTION=192.168.2.6 63814 192.168.1.103 22
TERM=su
USER=mqudsi
fish_user_paths=/home/mqudsi/.cargo/bin�/usr/home/mqudsi/.config/nvim/dein/repos/github.com/junegunn/fzf/bin
bind: Key with name 'up' does not have any mapping
bind: Key with name 'f1' does not have any mapping
bind: Key with name 'right' does not have any mapping
bind: Key with name 'dc' does not have any mapping

This causes problems for scripts that don't distinguish between stdout and stderr (which unfortunately are not as rare as I'd like), such as vim.

Not sure if we should ignore bind errors during the fish startup stage or if we should explore a different option.

@mqudsi

This comment has been minimized.

Copy link
Contributor

mqudsi commented Sep 27, 2017

Note that there may be a second bug here as well, since these are the default fish key bindings. So fish certainly shouldn't be trying to automatically bind to keys that aren't defined in termcap for the current $TERM.

@krader1961

This comment has been minimized.

Copy link
Contributor

krader1961 commented Sep 27, 2017

Isn't this a duplicate of issue #4188?

@faho

This comment has been minimized.

Copy link
Member

faho commented Sep 27, 2017

Yes, duplicate of #4188 - note that I've also suggested removing the warnings there.

So fish certainly shouldn't be trying to automatically bind to keys that aren't defined in termcap for the current $TERM.

The bind call will take care of ignoring any keys that aren't set - that's why it prints a warning.

@faho faho closed this Sep 27, 2017

@faho faho added the duplicate label Sep 27, 2017

mqudsi added a commit to mqudsi/fish-shell that referenced this issue Oct 3, 2017

Silence bind errors in default key bindings
This silences binding errors due to keys not found in the current
termcap config in the default fish bindings.

Closes fish-shell#4188, fish-shell#4431, and obviates the original fix for fish-shell#1155

mqudsi added a commit to mqudsi/fish-shell that referenced this issue Oct 3, 2017

Silence bind errors in default key bindings
This silences binding errors due to keys not found in the current
termcap config in the default fish bindings.

Closes fish-shell#4188, fish-shell#4431, and obviates the original fix for fish-shell#1155

It was necessary to re-implement builtin_bind as a class in order to
avoid passing around the options array from function to function and
as adding an opts parameter to `get_terminfo_sequence` would require
otps to be passed to all other builtin_bind_ functions so they could, in
turn, pass it to `get_terminfo_sequence`.

mqudsi added a commit that referenced this issue Oct 3, 2017

Silence bind errors in default key bindings
This silences binding errors due to keys not found in the current
termcap config in the default fish bindings.

Closes #4188, #4431, and obviates the original fix for #1155

It was necessary to re-implement builtin_bind as a class in order to
avoid passing around the options array from function to function and
as adding an opts parameter to `get_terminfo_sequence` would require
otps to be passed to all other builtin_bind_ functions so they could, in
turn, pass it to `get_terminfo_sequence`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment