summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--examples/plugin_linemode.py2
-rw-r--r--examples/rc_emacs.conf4
-rw-r--r--ranger/config/commands.py18
-rw-r--r--ranger/config/rc.conf4
-rw-r--r--ranger/container/directory.py6
-rw-r--r--ranger/container/fsobject.py9
-rw-r--r--ranger/core/linemode.py2
7 files changed, 23 insertions, 22 deletions
diff --git a/examples/plugin_linemode.py b/examples/plugin_linemode.py
index e4513f5d..8a92552e 100644
--- a/examples/plugin_linemode.py
+++ b/examples/plugin_linemode.py
@@ -13,4 +13,4 @@ from ranger.core.linemode import LinemodeBase
 class MyLinemode(LinemodeBase):
     name = "rot13"
     def filetitle(self, file, metadata):
-        return codecs.encode(file.basename, "rot_13")
+        return codecs.encode(file.relative_path, "rot_13")
diff --git a/examples/rc_emacs.conf b/examples/rc_emacs.conf
index aab083f4..e8b76ff2 100644
--- a/examples/rc_emacs.conf
+++ b/examples/rc_emacs.conf
@@ -318,8 +318,8 @@ map <C-x>wn shell -f echo -n %f    | xsel -i; xsel -o | xsel -i -b
 map <C-x>= chmod
 
 map <A-d>  console rename%space
-map <C-e>  eval fm.open_console('rename ' + fm.thisfile.basename)
-map <C-a>  eval fm.open_console('rename ' + fm.thisfile.basename, position=7)
+map <C-e>  eval fm.open_console('rename ' + fm.thisfile.relative_path)
+map <C-a>  eval fm.open_console('rename ' + fm.thisfile.relative_path, position=7)
 
 map <C-y>y  paste
 map <C-y>o  paste overwrite=True
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index cb62a62b..acc98457 100644
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -520,7 +520,7 @@ class delete(Command):
 
         if confirm != 'never' and (confirm != 'multiple' or many_files):
             self.fm.ui.console.ask("Confirm deletion of: %s (y/N)" %
-                ', '.join(f.basename for f in self.fm.thistab.get_selection()),
+                ', '.join(f.relative_path for f in self.fm.thistab.get_selection()),
                 self._question_callback, ('n', 'N', 'y', 'Y'))
         else:
             # no need for a confirmation, just delete
@@ -733,7 +733,7 @@ class rename(Command):
         new_name = self.rest(1)
 
         tagged = {}
-        old_name = self.fm.thisfile.basename
+        old_name = self.fm.thisfile.relative_path
         for f in self.fm.tags.tags:
             if str(f).startswith(self.fm.thisfile.path):
                 tagged[f] = self.fm.tags.tags[f]
@@ -742,7 +742,7 @@ class rename(Command):
         if not new_name:
             return self.fm.notify('Syntax: rename <newname>', bad=True)
 
-        if new_name == self.fm.thisfile.basename:
+        if new_name == old_name:
             return
 
         if access(new_name, os.F_OK):
@@ -767,10 +767,10 @@ class rename_append(Command):
 
     def execute(self):
         cf = self.fm.thisfile
-        if cf.basename.find('.') != 0 and cf.basename.rfind('.') != -1 and not cf.is_directory:
-            self.fm.open_console('rename ' + cf.basename, position=(7 + cf.basename.rfind('.')))
+        if cf.relative_path.find('.') != 0 and cf.relative_path.rfind('.') != -1 and not cf.is_directory:
+            self.fm.open_console('rename ' + cf.relative_path, position=(7 + cf.relative_path.rfind('.')))
         else:
-            self.fm.open_console('rename ' + cf.basename)
+            self.fm.open_console('rename ' + cf.relative_path)
 
 class chmod(Command):
     """:chmod <octal number>
@@ -905,7 +905,7 @@ class relink(Command):
             return self.fm.notify('Syntax: relink <newpath>', bad=True)
 
         if not cf.is_link:
-            return self.fm.notify('%s is not a symlink!' % cf.basename, bad=True)
+            return self.fm.notify('%s is not a symlink!' % cf.relative_path, bad=True)
 
         if new_path == os.readlink(cf.path):
             return
@@ -1134,7 +1134,7 @@ class scout(Command):
                     thisdir.mark_item(f, value)
             else:
                 for f in thisdir.files:
-                    if regex.search(f.basename):
+                    if regex.search(f.relative_path):
                         thisdir.mark_item(f, value)
 
         if self.PERM_FILTER in flags:
@@ -1242,7 +1242,7 @@ class scout(Command):
         i = offset
         regex = self._build_regex()
         for fsobj in deq:
-            if regex.search(fsobj.basename):
+            if regex.search(fsobj.relative_path):
                 count += 1
                 if move and count == 1:
                     cwd.move(to=(cwd.pointer + i) % len(cwd.files))
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index 727ba7b3..f34b6e0c 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -339,8 +339,8 @@ map =  chmod
 
 map cw console rename%space
 map a  rename_append
-map A  eval fm.open_console('rename ' + fm.thisfile.basename)
-map I  eval fm.open_console('rename ' + fm.thisfile.basename, position=7)
+map A  eval fm.open_console('rename ' + fm.thisfile.relative_path)
+map I  eval fm.open_console('rename ' + fm.thisfile.relative_path, position=7)
 
 map pp paste
 map po paste overwrite=True
diff --git a/ranger/container/directory.py b/ranger/container/directory.py
index 9f554ad1..b851eece 100644
--- a/ranger/container/directory.py
+++ b/ranger/container/directory.py
@@ -20,12 +20,12 @@ from ranger.ext.human_readable import human_readable
 from ranger.container.settings import LocalSettings
 
 def sort_by_basename(path):
-    """returns path.basename (for sorting)"""
+    """returns path.relative_path (for sorting)"""
     return path.relative_path
 
 def sort_by_basename_icase(path):
-    """returns case-insensitive path.basename (for sorting)"""
-    return path.basename_lower
+    """returns case-insensitive path.relative_path (for sorting)"""
+    return path.relative_path_lower
 
 def sort_by_directory(path):
     """returns 0 if path is a directory, otherwise 1 (for sorting)"""
diff --git a/ranger/container/fsobject.py b/ranger/container/fsobject.py
index 1bf08e20..a8c70e03 100644
--- a/ranger/container/fsobject.py
+++ b/ranger/container/fsobject.py
@@ -37,13 +37,14 @@ def safe_path(path):
 
 class FileSystemObject(FileManagerAware, SettingsAware):
     (basename,
-    basename_lower,
+    relative_path,
+    relative_path_lower,
     dirname,
     extension,
     infostring,
     path,
     permissions,
-    stat) = (None,) * 8
+    stat) = (None,) * 9
 
     (content_loaded,
     force_load,
@@ -100,7 +101,7 @@ class FileSystemObject(FileManagerAware, SettingsAware):
         else:
             self.basename = basename(path)
             self.relative_path = relpath(path, basename_is_rel_to)
-        self.basename_lower = self.relative_path.lower()
+        self.relative_path_lower = self.relative_path.lower()
         self.extension = splitext(self.basename)[1].lstrip(extsep) or None
         self.dirname = dirname(path)
         self.preload = preload
@@ -149,7 +150,7 @@ class FileSystemObject(FileManagerAware, SettingsAware):
     @lazy_property
     def basename_natural_lower(self):
         return [c if i % 3 == 1 else (int(c) if c else 0) for i, c in \
-            enumerate(_extract_number_re.split(self.basename_lower))]
+            enumerate(_extract_number_re.split(self.relative_path_lower))]
 
     @lazy_property
     def safe_basename(self):
diff --git a/ranger/core/linemode.py b/ranger/core/linemode.py
index 56fd3522..76e8f7cc 100644
--- a/ranger/core/linemode.py
+++ b/ranger/core/linemode.py
@@ -61,7 +61,7 @@ class TitleLinemode(LinemodeBase):
     required_metadata = ["title"]
 
     def filetitle(self, file, metadata):
-        name = metadata.title or file.basename
+        name = metadata.title
         if metadata.year:
             return "%s - %s" % (metadata.year, name)
         else: