summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/core/actions.py18
-rw-r--r--ranger/core/tab.py1
2 files changed, 14 insertions, 5 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index bf2e84dd..b0e5bf02 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -20,6 +20,7 @@ from ranger.ext.next_available_filename import next_available_filename
 from ranger.ext.rifle import squash_flags
 from ranger.core.shared import FileManagerAware, EnvironmentAware, \
 		SettingsAware
+from ranger.core.tab import Tab
 from ranger.fsobject import File
 from ranger.core.loader import CommandLoader
 
@@ -834,12 +835,19 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 	# TODO: Need to rewrite this to fit the new tab model
 
 	def tab_open(self, name, path=None):
-		tab_has_changed = name != self.current_tab
+		tab_has_changed = (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._update_current_tab()
+		try:
+			tab = self.tabs[name]
+		except KeyError:
+			if path:
+				tab = Tab(path)
+			else:
+				tab = Tab(self.thistab.path)
+			self.tabs[name] = tab
+		tab.enter_dir(tab.path)
+		self.thistab = tab
+
 		if tab_has_changed:
 			self.change_mode('normal')
 			self.signal_emit('tab.change')
diff --git a/ranger/core/tab.py b/ranger/core/tab.py
index 8157ac37..86be1241 100644
--- a/ranger/core/tab.py
+++ b/ranger/core/tab.py
@@ -88,6 +88,7 @@ class Tab(FileManagerAware, SettingsAware):
 
 	def enter_dir(self, path, history = True):
 		"""Enter given path"""
+		# TODO: Ensure that there is always a self.thisdir
 		if path is None: return
 		path = str(path)