about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--TODO6
-rw-r--r--code/bars.rb2
-rw-r--r--code/draw.rb2
-rw-r--r--code/help.rb6
-rw-r--r--code/keys.rb42
5 files changed, 25 insertions, 33 deletions
diff --git a/TODO b/TODO
index bc2db460..41db1e6f 100644
--- a/TODO
+++ b/TODO
@@ -10,10 +10,10 @@ Critical Issues
 Minor Issues
 
    ( ) #0   09/07/17  the device is busy even if you're not on the device
-   ( ) #5   09/07/17  avoid using shell calls, it results in many problems
+   (X) #5   09/07/17  avoid using shell calls, it results in many problems
                can't answer questions of spawned processes
                specifically rm with write-protected files
-   ( ) #12  09/07/17  sync @marked with changes in on the file system
+   (X) #12  09/07/17  sync @marked with changes in on the file system
                if files are deleted, delete those from @marked too
    ( ) #14  09/07/18  Sorting sometimes doesn't work
 
@@ -41,7 +41,7 @@ Aesthetics
 Required for next Release
 
    ( ) #1   09/07/17  undo key (work in progress)
-   ( ) #5   09/07/17  avoid using shell calls, it results in many problems
+   (X) #5   09/07/17  avoid using shell calls, it results in many problems
                can't answer questions of spawned processes
                specifically rm with write-protected files
    (X) #8   09/07/17  Clear keybuffer after executing programs.
diff --git a/code/bars.rb b/code/bars.rb
index 08546a79..b3635e11 100644
--- a/code/bars.rb
+++ b/code/bars.rb
@@ -3,8 +3,6 @@ require 'thread'
 class Bar
 	def kill(evil = true)
 		Fm.bar_del(self)
-#		Fm.force_update
-
 		@thread.kill
 	end
 
diff --git a/code/draw.rb b/code/draw.rb
index 76c0f2d3..b32c49ff 100644
--- a/code/draw.rb
+++ b/code/draw.rb
@@ -281,7 +281,7 @@ module Fm
 			btm = lines - 1
 
 			case @buffer
-			when /^delete/, /^dd/, /^dfd/
+			when /^delete/, /^dd/
 				puti btm, "#@buffer    ".rjust(cols)
 				puti btm, 'Are you serious? (' + Option.confirm_string + ')'
 
diff --git a/code/help.rb b/code/help.rb
index f6ec1890..76a2b75b 100644
--- a/code/help.rb
+++ b/code/help.rb
@@ -63,8 +63,7 @@ module Fm
 	mkdir<name> or touch<name> to create dirs or files
 
 	move file to ~/.trash:     dd
-	delete file forever:       dfd
-	delete whole dir forever:  delete
+	delete selection forever:  delete
 
 	copy file:     cp or yy
 	cut file:      cut
@@ -201,8 +200,7 @@ module Fm
 	use deleteing commands with caution!
    dd:          Move selection to ~/.trash and memorize it's new path
 	             (so it can be pasted with p)
-	dfd:         Deletes the selection or empty directory
-	delete:      Remove whole selection with all contents
+	delete:      Remove whole selection with all contents recursively
 
    mv<name>:    move/rename file to <name>
 	cw<name>:    same as mv
diff --git a/code/keys.rb b/code/keys.rb
index f3ea33d0..cf585511 100644
--- a/code/keys.rb
+++ b/code/keys.rb
@@ -25,7 +25,6 @@ module Fm
 		need_confirmation = %w[
 			delete
 			dd
-			dfd
 		]
 
 
@@ -110,37 +109,33 @@ module Fm
 
 		when 'P'
 			for f in @copy
-				File.symlink(f.path, File.expand_path(f.basename))
+				File.symlink(f.path, File.expand_path(f.basename)) rescue nil
 			end
 
 		## Destructive {{{
 
+		## move to trash and copy new location
 		when 'dd' + Option.confirm_string
-			new_path = move_to_trash(currentfile)
-			if new_path
-				new_path = Directory::Entry.new(new_path)
-				new_path.get_data
-				@copy = [new_path]
-				@cut = false
-			end
-			@pwd.schedule
-
-		when 'dfd' + Option.confirm_string
-			cf = currentfile
-			if cf and cf.exists?
-				cf.delete!
-				@pwd.schedule
+			@copy = []
+			@cut = false
+			for file in selection
+				new_path = move_to_trash(file)
+				if new_path
+					file = Directory::Entry.new(new_path)
+					file.get_data
+					@copy << file
+				end
 			end
+			@marked.clear
+			@pwd.refresh!
 
+		## delete recursively forever
 		when 'delete' + Option.confirm_string
-			files = selection
-			@marked = []
-			for f in files
-				if f and f.exists? and f.dir?
-					system('rm', '-r', f.to_s)
-					@pwd.schedule
-				end
+			for file in selection
+				FileUtils.remove_entry_secure(file.path) rescue lograise
 			end
+			@marked.clear
+			@pwd.refresh!
 
 		when 'p'
 			if @cut
@@ -158,6 +153,7 @@ module Fm
 			if @memory[$1]
 				Action.move(selection, @memory[$1])
 			end
+			@marked.clear
 			@pwd.refresh!
 
 		when /^(mv|cw|rename)(.+)$/