rc patch.kak: fix quoting

I learned that

    $ foo="'1

    2'"
    $ echo $foo
    '1 2'

Quote some variables to avoid this double unescaping.
This commit is contained in:
Johannes Altmanninger 2024-01-24 23:57:06 +01:00 committed by Maxime Coste
parent 11e7e2964c
commit 2c944f6415
2 changed files with 2 additions and 2 deletions

View File

@ -43,7 +43,7 @@ define-command diff-jump -params .. -docstring %{
} }
set-register a %arg{@} set-register a %arg{@}
set-register | %{ set-register | %{
[ -n "$kak_reg_a" ] && eval set -- $kak_quoted_reg_a [ -n "$kak_reg_a" ] && eval set -- "$kak_quoted_reg_a"
cmd=$(column=$kak_reg_c perl -we ' cmd=$(column=$kak_reg_c perl -we '
sub quote { sub quote {
$SQ = "'\''"; $SQ = "'\''";

View File

@ -52,7 +52,7 @@ define-command patch -params .. -docstring %{
# Since registers are never empty, we get an empty arg even if # Since registers are never empty, we get an empty arg even if
# there were no args. This does no harm because we pass it to # there were no args. This does no harm because we pass it to
# a shell where it expands to nothing. # a shell where it expands to nothing.
eval set -- $kak_quoted_reg_a eval set -- "$kak_quoted_reg_a"
perl "${kak_reg_f%/*}/patch-range.pl" $min_line $max_line "$@" || perl "${kak_reg_f%/*}/patch-range.pl" $min_line $max_line "$@" ||
echo >$kak_command_fifo "set-register e fail 'patch: failed to apply selections, see *debug* buffer'" echo >$kak_command_fifo "set-register e fail 'patch: failed to apply selections, see *debug* buffer'"