summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-04-12 12:15:22 +0200
committerhut <hut@lavabit.com>2010-04-12 12:22:34 +0200
commit1019737b2570cebd09a2cdff29642085aa6d062e (patch)
treebe70686bdec6fe5dbc9100c22bcbc49019d9e3c0
parentbd0ede8de02eb47625464c1b48b11a68517c9232 (diff)
downloadranger-1019737b2570cebd09a2cdff29642085aa6d062e.tar.gz
Grey out copied/cut files.
-rw-r--r--ranger/colorschemes/default.py3
-rw-r--r--ranger/core/actions.py7
-rw-r--r--ranger/defaults/keys.py1
-rw-r--r--ranger/gui/context.py2
-rw-r--r--ranger/gui/widgets/browsercolumn.py3
5 files changed, 15 insertions, 1 deletions
diff --git a/ranger/colorschemes/default.py b/ranger/colorschemes/default.py
index 24f8ab91..ca8456e7 100644
--- a/ranger/colorschemes/default.py
+++ b/ranger/colorschemes/default.py
@@ -59,6 +59,9 @@ class Default(ColorScheme):
 					fg = white
 				else:
 					fg = red
+			if not context.selected and (context.cut or context.copied):
+				fg = black
+				attr |= bold
 			if context.main_column:
 				if context.selected:
 					attr |= bold
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index b64ef316..5daa383e 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -500,16 +500,23 @@ class Actions(EnvironmentAware, SettingsAware):
 	# -- File System Operations
 	# --------------------------
 
+	def uncut(self):
+		self.env.copy = set()
+		self.env.cut = False
+		self.ui.browser.main_column.request_redraw()
+
 	def copy(self):
 		"""Copy the selected items"""
 
 		selected = self.env.get_selection()
 		self.env.copy = set(f for f in selected if f in self.env.cwd.files)
 		self.env.cut = False
+		self.ui.browser.main_column.request_redraw()
 
 	def cut(self):
 		self.copy()
 		self.env.cut = True
+		self.ui.browser.main_column.request_redraw()
 
 	def paste_symlink(self):
 		from os import symlink, getcwd
diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py
index 6f50635e..c4b8e198 100644
--- a/ranger/defaults/keys.py
+++ b/ranger/defaults/keys.py
@@ -102,6 +102,7 @@ def initialize_commands(map):
 	# ------------------------------------------ file system operations
 	map('yy', fm.copy())
 	map('dd', fm.cut())
+	map('ud', fm.uncut())
 	map('pp', fm.paste())
 	map('po', fm.paste(overwrite=True))
 	map('pl', fm.paste_symlink())
diff --git a/ranger/gui/context.py b/ranger/gui/context.py
index 4ea50714..d4c1c94d 100644
--- a/ranger/gui/context.py
+++ b/ranger/gui/context.py
@@ -23,7 +23,7 @@ CONTEXT_KEYS = ['reset', 'error',
 		'good', 'bad',
 		'space', 'permissions', 'owner', 'group', 'mtime', 'nlink',
 		'scroll', 'all', 'bot', 'top', 'percentage',
-		'marked', 'tagged', 'tag_marker',
+		'marked', 'tagged', 'tag_marker', 'cut', 'copied',
 		'help_markup',
 		'seperator', 'key', 'special', 'border',
 		'title', 'text', 'highlight', 'bars', 'quotes', 'tab',
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index d8bfeb69..8301d26a 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -281,6 +281,9 @@ class BrowserColumn(Pager):
 				if stat.S_ISSOCK(mode):
 					this_color.append('socket')
 
+			if self.env.copy and drawn in self.env.copy:
+				this_color.append('cut' if self.env.cut else 'copied')
+
 			if drawn.islink:
 				this_color.append('link')
 				this_color.append(drawn.exists and 'good' or 'bad')