From b50c832a3533b61c8b92e01bccee413103f325d7 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Fri, 7 Feb 2025 12:28:37 +0100 Subject: [PATCH] abbr: Print optional set-cursor arg correctly Allows the output to round-trip. Fixes #11141 --- src/builtins/abbr.rs | 2 +- tests/checks/abbr.fish | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/builtins/abbr.rs b/src/builtins/abbr.rs index 9377e8a9a..323a6ace7 100644 --- a/src/builtins/abbr.rs +++ b/src/builtins/abbr.rs @@ -132,7 +132,7 @@ fn abbr_show(streams: &mut IoStreams) -> Option { for abbr in abbrs.list() { result.clear(); let mut add_arg = |arg: &wstr| { - if !result.is_empty() { + if !result.is_empty() && !result.ends_with("=") { result.push_str(" "); } result.push_utfstr(arg); diff --git a/tests/checks/abbr.fish b/tests/checks/abbr.fish index 7829e031a..813292476 100644 --- a/tests/checks/abbr.fish +++ b/tests/checks/abbr.fish @@ -204,3 +204,7 @@ abbr --add regex_name --regex '(*UTF).*' bar # CHECKERR: abbr: Regular expression compile error: using UTF is disabled by the application # CHECKERR: abbr: (*UTF).* # CHECKERR: abbr: ^ + +abbr --add foo --set-cursor 'foo % bar' +abbr | grep foo +# CHECK: abbr -a --set-cursor='%' -- foo 'foo % bar'