summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/config/commands.py4
-rw-r--r--ranger/core/actions.py34
-rw-r--r--ranger/core/environment.py3
-rw-r--r--ranger/core/fm.py2
-rw-r--r--ranger/gui/widgets/browsercolumn.py4
5 files changed, 23 insertions, 24 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index db411436..f58d3fbe 100644
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -559,7 +559,7 @@ class load_copy_buffer(Command):
 		except:
 			return self.fm.notify("Cannot open %s" % \
 					(fname or self.copy_buffer_filename), bad=True)
-		self.fm.env.copy = set(File(g) \
+		self.fm.copy_buffer = set(File(g) \
 			for g in f.read().split("\n") if exists(g))
 		f.close()
 		self.fm.ui.redraw_main_column()
@@ -580,7 +580,7 @@ class save_copy_buffer(Command):
 		except:
 			return self.fm.notify("Cannot open %s" % \
 					(fname or self.copy_buffer_filename), bad=True)
-		f.write("\n".join(f.path for f in self.fm.env.copy))
+		f.write("\n".join(f.path for f in self.fm.copy_buffer))
 		f.close()
 
 
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 31098738..40aca662 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -178,8 +178,8 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 		else:
 			macros['s'] = MACRO_FAIL
 
-		if self.fm.env.copy:
-			macros['c'] = [fl.path for fl in self.fm.env.copy]
+		if self.fm.copy_buffer:
+			macros['c'] = [fl.path for fl in self.fm.copy_buffer]
 		else:
 			macros['c'] = MACRO_FAIL
 
@@ -948,8 +948,8 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 	# --------------------------
 
 	def uncut(self):
-		self.env.copy = set()
-		self.env.cut = False
+		self.copy_buffer = set()
+		self.do_cut = False
 		self.ui.browser.main_column.request_redraw()
 
 	def copy(self, mode='set', narg=None, dirarg=None):
@@ -971,21 +971,21 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 			cwd.pointer = pos
 			cwd.correct_pointer()
 		if mode == 'set':
-			self.env.copy = set(selected)
+			self.copy_buffer = set(selected)
 		elif mode == 'add':
-			self.env.copy.update(set(selected))
+			self.copy_buffer.update(set(selected))
 		elif mode == 'remove':
-			self.env.copy.difference_update(set(selected))
-		self.env.cut = False
+			self.copy_buffer.difference_update(set(selected))
+		self.do_cut = False
 		self.ui.browser.main_column.request_redraw()
 
 	def cut(self, mode='set', narg=None, dirarg=None):
 		self.copy(mode=mode, narg=narg, dirarg=dirarg)
-		self.env.cut = True
+		self.do_cut = True
 		self.ui.browser.main_column.request_redraw()
 
 	def paste_symlink(self, relative=False):
-		copied_files = self.env.copy
+		copied_files = self.copy_buffer
 		for f in copied_files:
 			self.notify(next_available_filename(f.basename))
 			try:
@@ -998,7 +998,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 				self.notify(x)
 
 	def paste_hardlink(self):
-		for f in self.env.copy:
+		for f in self.copy_buffer:
 			try:
 				new_name = next_available_filename(f.basename)
 				link(f.path, join(getcwd(), new_name))
@@ -1006,7 +1006,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 				self.notify(x)
 
 	def paste_hardlinked_subtree(self):
-		for f in self.env.copy:
+		for f in self.copy_buffer:
 			try:
 				target_path = join(getcwd(), f.basename)
 				self._recurse_hardlinked_tree(f.path, target_path)
@@ -1029,7 +1029,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 
 	def paste(self, overwrite=False):
 		"""Paste the selected items into the current directory"""
-		copied_files = tuple(self.env.copy)
+		copied_files = tuple(self.copy_buffer)
 
 		if not copied_files:
 			return
@@ -1048,9 +1048,9 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 			cp_flags = ['--backup=numbered', '-a', '--']
 			mv_flags = ['--backup=numbered', '--']
 
-		if self.env.cut:
-			self.env.copy.clear()
-			self.env.cut = False
+		if self.do_cut:
+			self.copy_buffer.clear()
+			self.do_cut = False
 			if len(copied_files) == 1:
 				descr = "moving: " + one_file.path
 			else:
@@ -1081,7 +1081,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 		# XXX: warn when deleting mount points/unseen marked files?
 		self.notify("Deleting!")
 		selected = self.env.get_selection()
-		self.env.copy -= set(selected)
+		self.copy_buffer -= set(selected)
 		if selected:
 			for f in selected:
 				if isdir(f.path) and not os.path.islink(f.path):
diff --git a/ranger/core/environment.py b/ranger/core/environment.py
index affef49b..eae230b3 100644
--- a/ranger/core/environment.py
+++ b/ranger/core/environment.py
@@ -18,9 +18,7 @@ class Environment(SettingsAware, FileManagerAware, SignalDispatcher):
 	"""
 
 	cwd = None  # current directory
-	copy = None
 	cmd = None
-	cut = None
 	history = None
 	last_search = None
 	pathway = None
@@ -33,7 +31,6 @@ class Environment(SettingsAware, FileManagerAware, SignalDispatcher):
 		self.pathway = ()
 		self.keybuffer = KeyBuffer()
 		self.keymaps = KeyMaps(self.keybuffer)
-		self.copy = set()
 		self.history = History(self.settings.max_history_size, unique=False)
 
 		try:
diff --git a/ranger/core/fm.py b/ranger/core/fm.py
index 161818b9..141ffc7b 100644
--- a/ranger/core/fm.py
+++ b/ranger/core/fm.py
@@ -50,6 +50,8 @@ class FM(Actions, SignalDispatcher):
 		self.previews = {}
 		self.current_tab = 1
 		self.loader = Loader()
+		self.copy_buffer = set()
+		self.do_cut = False
 
 		self.log.append('ranger {0} started! Process ID is {1}.' \
 				.format(__version__, os.getpid()))
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index 3b73a115..b94fd7e5 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -205,7 +205,7 @@ class BrowserColumn(Pager):
 
 		self._set_scroll_begin()
 
-		copied = [f.path for f in self.env.copy]
+		copied = [f.path for f in self.fm.copy_buffer]
 		ellipsis = self.ellipsis[self.settings.unicode_ellipsis]
 
 		selected_i = self.target.pointer
@@ -279,7 +279,7 @@ class BrowserColumn(Pager):
 					this_color.append('device')
 
 			if drawn.path in copied:
-				this_color.append('cut' if self.env.cut else 'copied')
+				this_color.append('cut' if self.fm.do_cut else 'copied')
 
 			if drawn.is_link:
 				this_color.append('link')