mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-15 06:24:01 +00:00
parent
56b4763c67
commit
ae6bdfa37c
1 changed files with 10 additions and 11 deletions
|
@ -1,21 +1,20 @@
|
||||||
function fish_clipboard_paste
|
function fish_clipboard_paste
|
||||||
set -l data
|
set -l data
|
||||||
if type -q pbpaste
|
if type -q pbpaste
|
||||||
set data (pbpaste)
|
set data (pbpaste 2>/dev/null)
|
||||||
else if set -q WAYLAND_DISPLAY; and type -q wl-paste
|
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
|
else if type -q xsel
|
||||||
# Return if `xsel` failed.
|
set data (xsel --clipboard 2>/dev/null)
|
||||||
# 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
|
|
||||||
else if type -q xclip
|
else if type -q xclip
|
||||||
if not set data (xclip -selection clipboard -o 2>/dev/null)
|
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
|
return 1
|
||||||
end
|
end
|
||||||
end
|
|
||||||
# Also split on \r to turn it into a newline,
|
# Also split on \r to turn it into a newline,
|
||||||
# otherwise the output looks really confusing.
|
# otherwise the output looks really confusing.
|
||||||
set data (string split \r -- $data)
|
set data (string split \r -- $data)
|
||||||
|
|
Loading…
Reference in a new issue