From 83932441bb0cbe8fe0e873fc9018b0127b329a61 Mon Sep 17 00:00:00 2001
From: Fabian Homborg <FHomborg@gmail.com>
Date: Sun, 20 Jan 2019 11:12:27 +0100
Subject: [PATCH] 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.
---
 share/functions/fish_clipboard_paste.fish | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/share/functions/fish_clipboard_paste.fish b/share/functions/fish_clipboard_paste.fish
index 105ca1226..f9ab3dabe 100644
--- a/share/functions/fish_clipboard_paste.fish
+++ b/share/functions/fish_clipboard_paste.fish
@@ -26,7 +26,11 @@ function fish_clipboard_paste
     #
     # This eases pasting non-code (e.g. markdown or git commitishes).
     if __fish_commandline_is_singlequoted
-        set data (string replace -ra "(['\\\])" '\\\\\\\$1' -- $data)
+        if status test-feature string-replace-fewer-backslashes
+            set data (string replace -ra "(['\\\])" '\\\\$1' -- $data)
+        else
+            set data (string replace -ra "(['\\\])" '\\\\\\\$1' -- $data)
+        end
     end
     if not string length -q -- (commandline -c)
         # If we're at the beginning of the first line, trim whitespace from the start,