summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-01-28 01:49:16 +0100
committerhut <hut@lavabit.com>2013-01-28 01:52:03 +0100
commit0aaa87c4843e964b3229814db9280769bc43aff9 (patch)
treee52660ae9117108f5bd86e1055ef5d3ffd84ec28 /ranger
parent03910971926047e757c813ca8118b9d06ac85332 (diff)
downloadranger-0aaa87c4843e964b3229814db9280769bc43aff9.tar.gz
core.tab: fix incorrect pointer on tab change
To reproduce the bug that this patch fixes, do:
1. start in a place where the second item is a directory that contains
   at least two files  (the usual $HOME with sort_directories_first=True
   will likely do)
2. open (and enter) a new tab with ^N
3. move down and right, entering the directory. The cursor is now on
   file 1
4. switch to tab 1, then back to tab 2
5. now the cursor is on file 2 instead of file 1.
Diffstat (limited to 'ranger')
-rw-r--r--ranger/core/tab.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/ranger/core/tab.py b/ranger/core/tab.py
index 0aca332a..8ae74141 100644
--- a/ranger/core/tab.py
+++ b/ranger/core/tab.py
@@ -151,7 +151,13 @@ class Tab(FileManagerAware, SettingsAware):
 		self.thisdir.sort_directories_first = self.fm.settings.sort_directories_first
 		self.thisdir.sort_reverse = self.fm.settings.sort_reverse
 		self.thisdir.sort_if_outdated()
-		self._thisfile = self.thisdir.pointed_obj
+		if previous and previous.path != path:
+			self.thisfile = self.thisdir.pointed_obj
+		else:
+			# This avoids setting self.pointer (through the 'move' signal) and
+			# is required so that you can use enter_dir when switching tabs
+			# without messing up the pointer.
+			self._thisfile = self.thisdir.pointed_obj
 
 		if history:
 			self.history.add(new_thisdir)