add command to invert marks in current directory

This commit is contained in:
Olivier Perret committed 2016-10-09 18:19:32 +02:00
1 parent 4d8a37ebc9
commit 69ff83a4b0
6 files changed
+23 -7

No files matched your search

+17 -7
View File
@@ -343,22 +343,32 @@ func (nav *Nav) cd(wd string) error {
return nil
}
func (nav *Nav) toggle() {
if nav.currEmpty() {
return
}
path := nav.currPath()
func (nav *Nav) toggleMark(path string) {
if nav.marks[path] {
delete(nav.marks, path)
} else {
nav.marks[path] = true
}
}
func (nav *Nav) toggle() {
if nav.currEmpty() {
return
}
nav.toggleMark(nav.currPath())
nav.down(1)
}
func (nav *Nav) invert() {
last := nav.currDir()
for _, f := range last.fi {
path := filepath.Join(last.path, f.Name())
nav.toggleMark(path)
}
}
func (nav *Nav) save(keep bool) error {
if len(nav.marks) == 0 {
if nav.currEmpty() {