From b3c6256252c64eea4ab2e4649d0634fb8b08948e Mon Sep 17 00:00:00 2001 From: Wojciech Siewierski Date: Sat, 23 Jan 2016 21:57:22 +0100 Subject: config/commands.py: Reduce code duplication in :delete --- ranger/config/commands.py | 18 +++++++++--------- 1 file 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 [] -- cgit 1.4.1-2-gfad0