From b04dee358ea57b0e1bed9cb852abec5ece8a7d41 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Tue, 2 Apr 2024 17:47:56 +0200 Subject: [PATCH] Don't translate \n to enter Apparently it's never entere because we turn off ICRNL. I'm not sure why it says "no binding found". --- src/builtins/bind.rs | 2 +- src/key.rs | 2 +- tests/checks/bind.fish | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/builtins/bind.rs b/src/builtins/bind.rs index 3ddb73b82..812526c01 100644 --- a/src/builtins/bind.rs +++ b/src/builtins/bind.rs @@ -376,7 +376,7 @@ impl BuiltinBind { streams.err.append(wgettext_fmt!( "%ls: No binding found for key '%ls'\n", cmd, - eseq + seq[0] )); } else { streams.err.append(wgettext_fmt!( diff --git a/src/key.rs b/src/key.rs index 97bffbfab..36cd4de66 100644 --- a/src/key.rs +++ b/src/key.rs @@ -148,7 +148,7 @@ fn ascii_control(c: char) -> char { } pub(crate) fn canonicalize_keyed_control_char(c: char) -> char { - if c == ascii_control('m') || c == ascii_control('j') { + if c == ascii_control('m') { return Enter; } if c == ascii_control('i') { diff --git a/tests/checks/bind.fish b/tests/checks/bind.fish index b71785620..f48a9e544 100644 --- a/tests/checks/bind.fish +++ b/tests/checks/bind.fish @@ -113,4 +113,11 @@ bind tab bind ctrl-\b # CHECKERR: bind: Cannot add control modifier to control character 'ctrl-h' +# Either Return or ctrl-m. +bind \r +# CHECK: bind --preset enter execute +# Never Return, probably always ctrl-j. +bind \n 2>&1 +# CHECK: bind: No binding found for key 'ctrl-j' + exit 0