Skip to content

Conversation

@LangLangBart
Copy link
Contributor

@LangLangBart LangLangBart commented Dec 4, 2025

test(zsh): add test for C-r with foreign commands

Adds a test to retrieve foreign commands for user w/ SHARE_HISTORY set

ci: make docker command configurable via variable

allows me to run the test with podman

DOCKER=podman make docker-test

Comment on lines +544 to +547
# NOTE: 'Perl/$history' won't see foreign cmds immediately, unlike 'awk/fc'.
# Perl passes only because another cmd runs between mocking and triggering C-r
# https://github.com/junegunn/fzf/issues/4061
# https://zsh.org/mla/users/2024/msg00692.html
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as a reminder

We can't use Perl/fc because, unlike bash, zsh escapes actual newlines as \n.

bash: fc preserves actual newlines

printf 'foo\n
bar\n'
# foo

# bar

fc -rl -1
# 1        printf 'foo\n
# bar\n'

zsh: fc escapes newlines to \n

printf 'foo\n
bar\n'
# foo

# bar

fc -rl -1
    # 1  printf 'foo\n\nbar\n'

printf '%s\t%s\n' "${(kv)history[@]}"
# 1       printf 'foo\n
# bar\n'

...and trying to patch the issue by running fc -RI before calling the
$history array caused problems the last time we tried.

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

Successfully merging this pull request may close these issues.

1 participant