Skip to content
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

[1.70] Escape % in bash and zsh shell integration #157352

Merged
merged 2 commits into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ __vsc_update_cwd() {

__vsc_command_output_start() {
builtin printf "\033]633;C\007"
builtin printf "\033]633;E;$__vsc_current_command\007"
# Send command line, escaping printf format chars %
builtin printf "\033]633;E;$(echo $__vsc_current_command | sed s/%/%%/g)\007"
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't have to escape if $__vsc_current_command is passed as a separate parameter to printf, avoiding the need for the sub-shell and sed, like this:

builtin printf "\033]633;E;%s\007" "$__vsc_current_command"

}

__vsc_continuation_start() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ __vsc_update_cwd() {

__vsc_command_output_start() {
builtin printf "\033]633;C\007"
builtin printf "\033]633;E;$__vsc_current_command\007"
# Send command line, escaping printf format chars %
builtin printf "\033]633;E;$(echo $__vsc_current_command | sed s/%/%%/g)\007"
}

__vsc_continuation_start() {
Expand Down