summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2015-06-02 16:10:56 +0200
committerhut <hut@lepus.uberspace.de>2015-06-02 16:10:56 +0200
commit4cd48ead34d04a7cad41d012ee5670db9c90ed08 (patch)
tree7d98519b2f12dfd2340379fe4638baefb5291011 /ranger
parent984845bac7a6cc142e676557685daa66a468494e (diff)
parentdff0e71b2aa0c4f74816db0ffdd0c662836652cf (diff)
downloadranger-4cd48ead34d04a7cad41d012ee5670db9c90ed08.tar.gz
Merge branch 'flat_path_fixes' of https://github.com/Vifon/ranger
Diffstat (limited to 'ranger')
-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
5 files changed, 20 insertions, 19 deletions
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:
'/akkartik/mu/commit/cpp/036closure_name?h=main&id=82ac0b7ecbc145ed8c8ecd8309166f654af1ee75'>82ac0b7e ^
6c96a437 ^
ab6ed192 ^
0487a30e ^
aae198a9 ^
0f2781f8 ^
82ac0b7e ^

ae256ea1 ^

9dcbec39 ^
35064671 ^

af023b32 ^
ae256ea1 ^
3e5f4358 ^
9dcbec39 ^
3e5f4358 ^

f3760b0f ^
f22250a1 ^
9dcbec39 ^
82ac0b7e ^

795f5244 ^
57d01f21 ^
9dcbec39 ^
57d01f21 ^

f22250a1 ^
82ac0b7e ^



82ac0b7e ^


b24eb476 ^

82ac0b7e ^
1b76245c ^
82ac0b7e ^

ae256ea1 ^
af023b32 ^
b24eb476 ^
82ac0b7e ^
363be37f ^
1e38eee5 ^
363be37f ^

82ac0b7e ^




b24eb476 ^
82ac0b7e ^
f3760b0f ^
9dcbec39 ^
6c96a437 ^
1b76245c ^
82ac0b7e ^
1b76245c ^
1e38eee5 ^
82ac0b7e ^







b24eb476 ^
82ac0b7e ^
f3760b0f ^
9dcbec39 ^
1e38eee5 ^
82ac0b7e ^
f22250a1 ^

82ac0b7e ^

5f98a10c ^
b24eb476 ^

82ac0b7e ^
ae256ea1 ^
af023b32 ^
9dcbec39 ^
e4630643 ^

ae256ea1 ^
82ac0b7e ^
f3760b0f ^
82ac0b7e ^
1e38eee5 ^


1ead3562 ^
1e38eee5 ^
192d59d3 ^
1e38eee5 ^
9dcbec39 ^

2655ae72 ^



514f0e34 ^
760f683f ^

897ae8c1 ^
2655ae72 ^


aae198a9 ^
897ae8c1 ^
760f683f ^
2655ae72 ^

897ae8c1 ^

2655ae72 ^

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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170