mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
parent
56b4763c67
commit
ae6bdfa37c
1 changed files with 10 additions and 11 deletions
|
@ -1,21 +1,20 @@
|
|||
function fish_clipboard_paste
|
||||
set -l data
|
||||
if type -q pbpaste
|
||||
set data (pbpaste)
|
||||
set data (pbpaste 2>/dev/null)
|
||||
else if set -q WAYLAND_DISPLAY; and type -q wl-paste
|
||||
set data (wl-paste)
|
||||
set data (wl-paste 2>/dev/null)
|
||||
else if type -q xsel
|
||||
# Return if `xsel` failed.
|
||||
# That way we don't print the redundant (and overly verbose for this) commandline error.
|
||||
# Also require non-empty contents to not clear the buffer.
|
||||
if not set data (xsel --clipboard 2>/dev/null)
|
||||
return 1
|
||||
end
|
||||
set data (xsel --clipboard 2>/dev/null)
|
||||
else if type -q xclip
|
||||
if not set data (xclip -selection clipboard -o 2>/dev/null)
|
||||
return 1
|
||||
end
|
||||
set data (xclip -selection clipboard -o 2>/dev/null)
|
||||
end
|
||||
|
||||
# Issue 6254: Handle zero-length clipboard content
|
||||
if not string match -qr . -- "$data"
|
||||
return 1
|
||||
end
|
||||
|
||||
# Also split on \r to turn it into a newline,
|
||||
# otherwise the output looks really confusing.
|
||||
set data (string split \r -- $data)
|
||||
|
|
Loading…
Reference in a new issue