summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-01-10 03:49:58 +0100
committerhut <hut@lavabit.com>2013-01-10 03:49:58 +0100
commitf30f732d8833a784106090555b57526cc32ab709 (patch)
treeca91555dabc2a46ee83720d99a8c7ab410582da5 /ranger
parentd5ccc411a9a8f0904cefbde2d6069575acabb71c (diff)
downloadranger-f30f732d8833a784106090555b57526cc32ab709.tar.gz
config.commands: use new prompting mechanism for :delete
Diffstat (limited to 'ranger')
-rw-r--r--ranger/config/commands.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 07c595e0..c4192d0d 100644
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -517,12 +517,16 @@ class delete(Command):
 				and len(os.listdir(cf.path)) > 0))
 
 		if confirm != 'never' and (confirm != 'multiple' or many_files):
-			# better ask for a confirmation, when attempting to
-			# delete multiple files or a non-empty directory.
-			return self.fm.open_console(DELETE_WARNING)
+			self.fm.ui.console.ask("Confirm deletion of: %s (y/N)" %
+				', '.join(f.basename for f in self.fm.thistab.get_selection()),
+				self._question_callback, ('y', 'n', 'Y', 'N'))
+		else:
+			# no need for a confirmation, just delete
+			self.fm.delete()
 
-		# no need for a confirmation, just delete
-		self.fm.delete()
+	def _question_callback(self, answer):
+		if answer == 'y' or answer == 'Y':
+			self.fm.delete()
 
 
 class mark(Command):