summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-10-31 16:26:42 +0100
committerhut <hut@lavabit.com>2010-11-01 14:37:22 +0100
commit1c683951ef9c20a835ee828ee56f3f2cc30bb437 (patch)
tree44a6cc2acc46248b0c9de286a479fc178963b82d /ranger
parent4d49588e4c4d34f7fcdf765fe86274757674f1a1 (diff)
downloadranger-1c683951ef9c20a835ee828ee56f3f2cc30bb437.tar.gz
Added option 'padding_right' (default: True)
This allows you to hide the last column if there's nothing
inside, saving some space.
Diffstat (limited to 'ranger')
-rw-r--r--ranger/container/settingobject.py1
-rw-r--r--ranger/defaults/options.py4
-rw-r--r--ranger/gui/widgets/browserview.py14
3 files changed, 16 insertions, 3 deletions
diff --git a/ranger/container/settingobject.py b/ranger/container/settingobject.py
index abdc19de..4c910bf4 100644
--- a/ranger/container/settingobject.py
+++ b/ranger/container/settingobject.py
@@ -36,6 +36,7 @@ ALLOWED_SETTINGS = {
 	'preview_directories': bool,
 	'preview_files': bool,
 	'preview_script': (str, type(None)),
+	'padding_right': bool,
 	'save_console_history': bool,
 	'scroll_offset': int,
 	'shorten_title': int,  # Note: False is an instance of int
diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py
index 8a9f5225..baaec7a3 100644
--- a/ranger/defaults/options.py
+++ b/ranger/defaults/options.py
@@ -101,6 +101,10 @@ scroll_offset = 8
 # Flush the input after each key hit?  (Noticable when ranger lags)
 flushinput = True
 
+# Padding on the right when there's no preview?
+# This allows you to click into the space to run the file.
+padding_right = True
+
 # Save bookmarks (used with mX and `X) instantly?
 # This helps to synchronize bookmarks between multiple ranger
 # instances but leads to *slight* performance loss.
diff --git a/ranger/gui/widgets/browserview.py b/ranger/gui/widgets/browserview.py
index 8857c15e..a4626412 100644
--- a/ranger/gui/widgets/browserview.py
+++ b/ranger/gui/widgets/browserview.py
@@ -60,10 +60,11 @@ class BrowserView(Widget, DisplayableContainer):
 		ratio_sum = float(sum(ratios))
 		self.ratios = tuple(x / ratio_sum for x in ratios)
 
+		last = 0.1 if self.settings.padding_right else 0
 		if len(self.ratios) >= 2:
 			self.stretch_ratios = self.ratios[:-2] + \
-					((self.ratios[-2] + self.ratios[-1] * 0.9),
-					(self.ratios[-1] * 0.1))
+					((self.ratios[-2] + self.ratios[-1] * 1.0 - last),
+					(self.ratios[-1] * last))
 
 		offset = 1 - len(ratios)
 		if self.preview: offset += 1
@@ -230,13 +231,20 @@ class BrowserView(Widget, DisplayableContainer):
 		for i, ratio in generator:
 			wid = int(ratio * self.wid)
 
+			cut_off = self.is_collapsed and not self.settings.padding_right
 			if i == last_i:
-				wid = int(self.wid - left + 1 - pad)
+				if not cut_off:
+					wid = int(self.wid - left + 1 - pad)
 
 			if i == last_i - 1:
 				self.pager.resize(pad, left, hei - pad * 2, \
 						max(1, self.wid - left - pad))
 
+				if cut_off:
+					self.columns[i].resize(pad, left, hei - pad * 2, \
+							max(1, self.wid - left - pad))
+					continue
+
 			try:
 				self.columns[i].resize(pad, left, hei - pad * 2, \
 						max(1, wid - 1))