summary refs log tree commit diff stats
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
parentd5ccc411a9a8f0904cefbde2d6069575acabb71c (diff)
downloadranger-f30f732d8833a784106090555b57526cc32ab709.tar.gz
config.commands: use new prompting mechanism for :delete
-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):
.com> 2010-04-13 17:57:46 +0200 dirarg: added unit test and almost working implementaiton' href='/akspecs/ranger/commit/test/tc_direction.py?h=v1.2.1&id=447cbcd65588eafdb85b407750602c0fdd591ef4'>447cbcd6 ^
76e9b89a ^
447cbcd6 ^
7a2665c2 ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88