summary refs log tree commit diff stats
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
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.
-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)
0 23:01:13 -0400 committer Ben Morrison <ben@gbmor.dev> 2019-05-21 03:42:18 -0400 added cache update / db push intervals to conf;' href='/gbmor/getwtxt/commit/init.go?h=v0.4.8&id=bd23ef0959496aba4c6fc8ca2b3969bbf17aa9d5'>bd23ef0 ^
06cffd8 ^
c5cf0e1 ^
cf6c849 ^
8630499 ^
cf6c849 ^
69217dd ^


a0be15e ^

cd635e6 ^
06cffd8 ^

d083ce6 ^
06cffd8 ^
bd23ef0 ^

887c25e ^
bd23ef0 ^
e34697c ^
920306c ^
efa99ed ^

c896e6b ^
df1d1ef ^
4695425 ^
2b0d4a5 ^
6c1b09b ^











6753171 ^



f2d85b6 ^
1f8b2ce ^
06cffd8 ^
06cffd8 ^
c896e6b ^
71971db ^
e34697c ^
5310d08 ^
06cffd8 ^

f2d85b6 ^
1f8b2ce ^
f2d85b6 ^




bd23ef0 ^

f2d85b6 ^
67864b2 ^
cf6c849 ^





f2d85b6 ^

5310d08 ^







5310d08 ^
c896e6b ^
cd635e6 ^
cd635e6 ^
887c25e ^
b29e1c1 ^
887c25e ^

887c25e ^
78f4d8a ^


c896e6b ^

cd635e6 ^
d083ce6 ^
5310d08 ^

cd635e6 ^
b29e1c1 ^
d083ce6 ^
efa99ed ^

c896e6b ^
5310d08 ^



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