about summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-04-12 12:15:22 +0200
committerhut <hut@lavabit.com>2010-04-12 12:19:20 +0200
commiteb3795d352893ce760bfa31383cf98ba1ad9d113 (patch)
tree1b17f5e7d5c730c7da2f2f75e21c81a65eb8ff0d /ranger
parentc0914664cf35ea0f06cb4c24f983d62096594d0c (diff)
downloadranger-eb3795d352893ce760bfa31383cf98ba1ad9d113.tar.gz
Grey out copied/cut files.
Diffstat (limited to 'ranger')
-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 0f8b74e5..c0599b46 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -531,16 +531,23 @@ class Actions(FileManagerAware, 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 b43744a9..7a235a5d 100644
--- a/ranger/defaults/keys.py
+++ b/ranger/defaults/keys.py
@@ -108,6 +108,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 4e93ed3e..8cf8990c 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')