diff options
-rwxr-xr-x | ranger/config/commands.py | 8 | ||||
-rw-r--r-- | ranger/container/fsobject.py | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py index bf03069f..7f5fc764 100755 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -1727,7 +1727,7 @@ class yank(Command): modes = { '': 'basename', - 'name_without_extension': 'splitext', + 'name_without_extension': 'basename_without_extension', 'name': 'basename', 'dir': 'dirname', 'path': 'path', @@ -1761,11 +1761,7 @@ class yank(Command): clipboard_commands = clipboards() mode = self.modes[self.arg(1)] - if mode == "splitext": - selection = [os.path.splitext(item)[0] for item in - self.get_selection_attr('basename')] - else: - selection = self.get_selection_attr(mode) + selection = self.get_selection_attr(mode) new_clipboard_contents = "\n".join(selection) for command in clipboard_commands: diff --git a/ranger/container/fsobject.py b/ranger/container/fsobject.py index 0c9f70f6..37151ecf 100644 --- a/ranger/container/fsobject.py +++ b/ranger/container/fsobject.py @@ -6,7 +6,7 @@ from __future__ import (absolute_import, division, print_function) import re from grp import getgrgid from os import lstat, stat -from os.path import abspath, basename, dirname, realpath, relpath +from os.path import abspath, basename, dirname, realpath, relpath, splitext from pwd import getpwuid from time import time @@ -171,6 +171,10 @@ class FileSystemObject( # pylint: disable=too-many-instance-attributes,too-many return basename_list @lazy_property + def basename_without_extension(self): + return splitext(self.basename)[0] + + @lazy_property def safe_basename(self): return self.basename.translate(_SAFE_STRING_TABLE) |