summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2012-08-05 15:23:10 +0200
committerhut <hut@lavabit.com>2012-08-05 15:23:10 +0200
commit1ac303c177128e7a0fcf53a92cd0393917f531ec (patch)
tree7a2ee850354570b2cb778df1e5dea762cabb2b22 /ranger
parent7f9df493dd6b0fd13abe93ddfea2755ee24c3d72 (diff)
downloadranger-1ac303c177128e7a0fcf53a92cd0393917f531ec.tar.gz
core.actions: updated tab_open to work with new Tab class
Diffstat (limited to 'ranger')
-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)