Fix fish_clipboard_paste with string-replace-fewer-backslashes

This is the one place in fish where we use a `\` in the replacement of
a `string replace -r`, so we'll have to check the feature.
This commit is contained in:
Fabian Homborg 2019-01-20 11:12:27 +01:00
parent 864bb1f7a6
commit 83932441bb

View file

@ -26,8 +26,12 @@ function fish_clipboard_paste
# #
# This eases pasting non-code (e.g. markdown or git commitishes). # This eases pasting non-code (e.g. markdown or git commitishes).
if __fish_commandline_is_singlequoted if __fish_commandline_is_singlequoted
if status test-feature string-replace-fewer-backslashes
set data (string replace -ra "(['\\\])" '\\\\$1' -- $data)
else
set data (string replace -ra "(['\\\])" '\\\\\\\$1' -- $data) set data (string replace -ra "(['\\\])" '\\\\\\\$1' -- $data)
end end
end
if not string length -q -- (commandline -c) if not string length -q -- (commandline -c)
# If we're at the beginning of the first line, trim whitespace from the start, # If we're at the beginning of the first line, trim whitespace from the start,
# so we don't trigger ignoring history. # so we don't trigger ignoring history.