summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2012-08-05 15:52:53 +0200
committerhut <hut@lavabit.com>2012-08-05 15:52:53 +0200
commit90ce9ed7545b733fb1ec9e769c10bba6e3fd4ab2 (patch)
treea2de6f9a9cc832ffa41055f259a4b23284c84133
parenta8c5614b8e3092d307b917654eb085f4b8aa87cf (diff)
downloadranger-90ce9ed7545b733fb1ec9e769c10bba6e3fd4ab2.tar.gz
core.tab: save and restore pointer when changing tab
-rw-r--r--ranger/core/tab.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/ranger/core/tab.py b/ranger/core/tab.py
index bf837df3..0244adec 100644
--- a/ranger/core/tab.py
+++ b/ranger/core/tab.py
@@ -14,14 +14,24 @@ class Tab(FileManagerAware, SettingsAware):
 		self._thisfile = None  # Current File
 		self.history = History(self.settings.max_history_size, unique=False)
 		self.last_search = None
+		self.pointer = 0
 		self.path = abspath(expanduser(path))
 		self.pathway = ()
 		self.fm.signal_bind('move', self._set_thisfile_from_signal, priority=0.1,
 				weak=True)
+		self.fm.signal_bind('tab.change', self._on_tab_change, weak=True)
 
 	def _set_thisfile_from_signal(self, signal):
 		if self == signal.tab:
 			self._thisfile = signal.new
+			if self == self.fm.thistab:
+				self.pointer = self.thisdir.pointer
+
+	def _on_tab_change(self, signal):
+		if self == self.fm.thistab and self.thisdir:
+			# restore the pointer whenever this tab is reopened
+			self.thisdir.pointer = self.pointer
+			self.thisdir.correct_pointer()
 
 	def _set_thisfile(self, value):
 		if value is not self._thisfile:
113bc9e ^
28e03ac ^
113bc9e ^
















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