summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorWojciech Siewierski <wojciech.siewierski@onet.pl>2016-01-23 21:57:22 +0100
committerWojciech Siewierski <wojciech.siewierski@onet.pl>2016-01-23 21:57:22 +0100
commitb3c6256252c64eea4ab2e4649d0634fb8b08948e (patch)
treef5be3c21b42e5c450e979fcd8299c62b9d31ade7 /ranger
parent72e783db75348aa7a5e5f721a2a2086c45a666c6 (diff)
downloadranger-b3c6256252c64eea4ab2e4649d0634fb8b08948e.tar.gz
config/commands.py: Reduce code duplication in :delete
Diffstat (limited to 'ranger')
-rw-r--r--ranger/config/commands.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 40377547..86db4bea 100644
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -536,18 +536,18 @@ class delete(Command):
                 self._question_callback, ('n', 'N', 'y', 'Y'))
         else:
             # no need for a confirmation, just delete
-            for f in self.fm.tags.tags:
-                if str(f).startswith(self.fm.thisfile.path):
-                    self.fm.tags.remove(f)
-            self.fm.delete()
+            self._delete_with_tags()
+
+    def _delete_with_tags(self):
+        # Delete the selected files and untag them.
+        for f in self.fm.tags.tags:
+            if str(f).startswith(self.fm.thisfile.path):
+                self.fm.tags.remove(f)
+        self.fm.delete()
 
     def _question_callback(self, answer):
         if answer == 'y' or answer == 'Y':
-            for f in self.fm.tags.tags:
-                if str(f).startswith(self.fm.thisfile.path):
-                    self.fm.tags.remove(f)
-            self.fm.delete()
-
+            self._delete_with_tags()
 
 class mark_tag(Command):
     """:mark_tag [<tags>]