abbr: Print optional set-cursor arg correctly

Allows the output to round-trip.

Fixes #11141

(cherry picked from commit b50c832a3533b61c8b92e01bccee413103f325d7)
This commit is contained in:
Fabian Boehm 2025-02-07 12:28:37 +01:00
parent 65ac71edcc
commit 47d3189614
2 changed files with 5 additions and 1 deletions

View File

@ -132,7 +132,7 @@ fn abbr_show(streams: &mut IoStreams) -> Option<c_int> {
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);

View File

@ -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'