keep copy selections after paste (#745)

This commit is contained in:
Christian Zangl 2022-02-04 17:21:03 +01:00 committed by GitHub
parent 958857f4c4
commit a4842e19d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 18 deletions

4
doc.go
View File

@ -1098,9 +1098,9 @@ You can use the following example as a starting point:
cp -R $list .
elif [ $mode = 'move' ]; then
mv $list .
rm ~/.local/share/lf/files
lf -remote 'send clear'
fi
rm ~/.local/share/lf/files
lf -remote 'send clear'
}}
Some useful things to be considered are to use the backup ('--backup') and/or preserve attributes ('-a') options with 'cp' and 'mv' commands if they support it (i.e. GNU implementation), change the command type to asynchronous, or use 'rsync' command with progress bar option for copying and feed the progress to the client periodically with remote 'echo' calls.

View File

@ -1215,9 +1215,9 @@ point:
cp -R $list .
elif [ $mode = 'move' ]; then
mv $list .
rm ~/.local/share/lf/files
lf -remote 'send clear'
fi
rm ~/.local/share/lf/files
lf -remote 'send clear'
}}
Some useful things to be considered are to use the backup ('--backup')

4
lf.1
View File

@ -1272,9 +1272,9 @@ You can customize copy and move operations by defining a 'paste' command. This i
cp -R $list .
elif [ $mode = 'move' ]; then
mv $list .
rm ~/.local/share/lf/files
lf -remote 'send clear'
fi
rm ~/.local/share/lf/files
lf -remote 'send clear'
}}
.EE
.PP

23
nav.go
View File

@ -1043,19 +1043,18 @@ func (nav *nav) paste(ui *ui) error {
go nav.copyAsync(ui, srcs, dstDir)
} else {
go nav.moveAsync(ui, srcs, dstDir)
}
if err := saveFiles(nil, false); err != nil {
return fmt.Errorf("clearing copy/cut buffer: %s", err)
}
if gSingleMode {
if err := nav.sync(); err != nil {
return fmt.Errorf("paste: %s", err)
if err := saveFiles(nil, false); err != nil {
return fmt.Errorf("clearing copy/cut buffer: %s", err)
}
} else {
if err := remote("send sync"); err != nil {
return fmt.Errorf("paste: %s", err)
if gSingleMode {
if err := nav.sync(); err != nil {
return fmt.Errorf("paste: %s", err)
}
} else {
if err := remote("send sync"); err != nil {
return fmt.Errorf("paste: %s", err)
}
}
}