mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 03:41:27 +00:00
Fix dragdrop not working in selection mode (#382)
xargs couldn't call function `dnd()` and I couldn't find a portable way to do it, so I replaced it with a variable which I guess should work fine.
This commit is contained in:
parent
950a8f6a65
commit
688ed885d1
|
@ -16,15 +16,11 @@
|
||||||
selection=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection
|
selection=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection
|
||||||
resp=f
|
resp=f
|
||||||
all=
|
all=
|
||||||
|
if which dragon-drag-and-drop 2>&1 >/dev/null; then
|
||||||
dnd()
|
dnd="dragon-drag-and-drop"
|
||||||
{
|
else
|
||||||
if which dragon-drag-and-drop 2>&1 >/dev/null; then
|
dnd="dragon"
|
||||||
dragon-drag-and-drop "$@" 2>/dev/null
|
fi
|
||||||
else
|
|
||||||
dragon "$@" 2>/dev/null
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function add_file() {
|
function add_file() {
|
||||||
echo -n "$@" >> "$selection"
|
echo -n "$@" >> "$selection"
|
||||||
|
@ -55,13 +51,13 @@ fi
|
||||||
|
|
||||||
if [ "$resp" = "s" ]; then
|
if [ "$resp" = "s" ]; then
|
||||||
use_all
|
use_all
|
||||||
sed -z 's|'"$PWD/"'||g' < "$selection" | xargs -0 dnd "$all" &
|
sed -z 's|'"$PWD/"'||g' < "$selection" | xargs -0 "$dnd" "$all" &
|
||||||
elif [ "$resp" = "d" ]; then
|
elif [ "$resp" = "d" ]; then
|
||||||
use_all
|
use_all
|
||||||
dnd "$all" "$PWD/"* &
|
"$dnd" "$all" "$PWD/"* &
|
||||||
elif [ "$resp" = "r" ]; then
|
elif [ "$resp" = "r" ]; then
|
||||||
echo -n > "$selection"
|
echo -n > "$selection"
|
||||||
dnd --print-path --target | while read f
|
"$dnd" --print-path --target | while read f
|
||||||
do
|
do
|
||||||
if echo -n "$f" | grep '^\(https\?\|ftps\?\|s\?ftp\):\/\/' ; then
|
if echo -n "$f" | grep '^\(https\?\|ftps\?\|s\?ftp\):\/\/' ; then
|
||||||
curl -LJO "$f"
|
curl -LJO "$f"
|
||||||
|
@ -72,7 +68,7 @@ elif [ "$resp" = "r" ]; then
|
||||||
done &
|
done &
|
||||||
else
|
else
|
||||||
if [ -n "$1" ] && [ -e "$1" ]; then
|
if [ -n "$1" ] && [ -e "$1" ]; then
|
||||||
dnd "$1" &
|
"$dnd" "$1" &
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue