about summary refs log tree commit diff stats
path: root/code
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-07-18 22:57:20 +0200
committerhut <hut@lavabit.com>2009-07-18 22:57:20 +0200
commit06d077c641f856021b9a6afbc28d969bd2473ce8 (patch)
treee19c969bb2f59ae1e271ef0ba4fa9bbdaa88986d /code
parent506e5aa40eb5f828b7d61db088e2de6c71d3a9b6 (diff)
downloadranger-06d077c641f856021b9a6afbc28d969bd2473ce8.tar.gz
fixed bugs 5 (use of system()) and 12 (sync @marked)
Diffstat (limited to 'code')
-rw-r--r--code/bars.rb2
-rw-r--r--code/draw.rb2
-rw-r--r--code/help.rb6
-rw-r--r--code/keys.rb42
4 files changed, 22 insertions, 30 deletions
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)(.+)$/