summary refs log tree commit diff stats
path: root/ranger/core/actions.py
diff options
context:
space:
mode:
Diffstat (limited to 'ranger/core/actions.py')
-rw-r--r--ranger/core/actions.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index d52dac2b..b40febc8 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -428,12 +428,15 @@ class Actions(EnvironmentAware, SettingsAware):
 	def _get_tab_list(self):
 		return sorted(self.tabs)
 
-	def tab_open(self, name):
-		if name in self.tabs:
-			self.current_tab = name
-			self.enter_dir(self.tabs[name], remember=False)
+	def tab_open(self, name, path=None):
+		do_emit_signal = name != self.current_tab
+		self.current_tab = name
+		if path or (name in self.tabs):
+			self.enter_dir(path or self.tabs[name])
 		else:
-			self.tab_new(name)
+			self._update_current_tab()
+		if do_emit_signal:
+			self.signal_emit('tab.change')
 
 	def tab_close(self, name=None):
 		if name is None:
@@ -454,12 +457,12 @@ class Actions(EnvironmentAware, SettingsAware):
 		if newtab != self.current_tab:
 			self.tab_open(newtab)
 
-	def tab_new(self, name, path=None):
-		self.current_tab = name
-		if path:
-			self.enter_dir(path, remember=False)
-		else:
-			self._update_current_tab()
+	def tab_new(self):
+		for i in range(10):
+			i = (i + 1) % 10
+			if not i in self.tabs:
+				self.tab_open(i)
+				break
 
 	def _update_current_tab(self):
 		self.tabs[self.current_tab] = self.env.cwd.path
>155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220