df658350a38aa73920fdefa5b255f8d7a58d31dc

Author
Carlo Sala <carlosalag@protonmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

fix(clipboard): move wsl detection to higher priority (#11440)

Closes #8827

Diff

 1diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh
 2index ad83fc4b2d21c1fcf0068ca6313b8b4f46e6a80c..2f3b6bcad2963001f0aa5f53130500185feb7e3e 100644
 3--- a/lib/clipboard.zsh
 4+++ b/lib/clipboard.zsh
 5@@ -57,6 +57,9 @@ function detect-clipboard() {
 6   elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then
 7     function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; }
 8     function clippaste() { cat /dev/clipboard; }
 9+  elif (( $+commands[clip.exe] )) && (( $+commands[powershell.exe] )); then
10+    function clipcopy() { cat "${1:-/dev/stdin}" | clip.exe; }
11+    function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
12   elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
13     function clipcopy() { cat "${1:-/dev/stdin}" | wl-copy &>/dev/null &|; }
14     function clippaste() { wl-paste; }
15@@ -81,9 +84,6 @@ function detect-clipboard() {
16   elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then
17     function clipcopy() { tmux load-buffer "${1:--}"; }
18     function clippaste() { tmux save-buffer -; }
19-  elif [[ $(uname -r) = *icrosoft* ]]; then
20-    function clipcopy() { cat "${1:-/dev/stdin}" | clip.exe; }
21-    function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
22   else
23     function _retry_clipboard_detection_or_fail() {
24       local clipcmd="${1}"; shift