diff options
author | hut <hut@lavabit.com> | 2013-02-05 05:55:53 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2013-02-05 05:55:53 +0100 |
commit | 151ff73951af08a7d5611c22ce25f095feda3c6b (patch) | |
tree | f618761a5681f0cd36a3c7c73f4c8793279099c5 | |
parent | 6483b2f2c6d10c15cd6f1eab5fa4dc6b08e305d4 (diff) | |
download | ranger-151ff73951af08a7d5611c22ce25f095feda3c6b.tar.gz |
core.tab: Fix files being treated as dirs after rename
When you deleted a directory and created a file with the same name, it was treated like a directory, with ranger trying to preview it and throwing lots of errors. This was because it tried to look for the path of the currently selected file in fm.directories - a directory cache - and if a file with the same name existed as a directory once, it would have found it there.
-rw-r--r-- | ranger/core/tab.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/ranger/core/tab.py b/ranger/core/tab.py index 8ae74141..443b2037 100644 --- a/ranger/core/tab.py +++ b/ranger/core/tab.py @@ -61,20 +61,15 @@ class Tab(FileManagerAware, SettingsAware): except IndexError: return None else: - directory = self.thisfile - for i in range(level - 1): + directory = self.thisdir + for i in range(level): if directory is None: return None if directory.is_directory: directory = directory.pointed_obj else: return None - try: - return self.fm.directories[directory.path] - except AttributeError: - return None - except KeyError: - return directory + return directory def get_selection(self): if self.thisdir: |