summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-12-15 11:15:01 +0100
committerhut <hut@lavabit.com>2009-12-15 11:15:01 +0100
commit705c14a48645f6e7e4b318a5a3f4f7a6c7b96c80 (patch)
treea1ed4ff7ed6e596857cc737a84e19e57772e211d
parentcfdbb9d634555f7c036861266e308b512f0baeac (diff)
downloadranger-705c14a48645f6e7e4b318a5a3f4f7a6c7b96c80.tar.gz
different way of squeezing the last column
-rw-r--r--ranger/gui/widgets/filelistcontainer.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/ranger/gui/widgets/filelistcontainer.py b/ranger/gui/widgets/filelistcontainer.py
index fa4ec989..cc45f2c9 100644
--- a/ranger/gui/widgets/filelistcontainer.py
+++ b/ranger/gui/widgets/filelistcontainer.py
@@ -8,6 +8,7 @@ class FileListContainer(Widget, DisplayableContainer):
 	ratios = None
 	preview = True
 	preview_available = True
+	stretch_ratios = None
 
 	def __init__(self, win, ratios, preview = True):
 		DisplayableContainer.__init__(self, win)
@@ -18,6 +19,11 @@ class FileListContainer(Widget, DisplayableContainer):
 		# normalize ratios:
 		ratio_sum = float(reduce(lambda x,y: x + y, ratios))
 		self.ratios = tuple(map(lambda x: x / ratio_sum, ratios))
+
+		if self.ratios >= 2:
+			self.stretch_ratios = self.ratios[:-2] + \
+					((self.ratios[-2] + self.ratios[-1] * 0.9), \
+					(self.ratios[-1] * 0.1))
 		
 		offset = 1 - len(ratios)
 		if preview: offset += 1
@@ -39,21 +45,25 @@ class FileListContainer(Widget, DisplayableContainer):
 		DisplayableContainer.resize(self, y, x, hei, wid)
 		left = self.x
 
-		cut_off_last = self.preview and not self.preview_available
+		cut_off_last = self.preview and not self.preview_available \
+				and self.stretch_ratios
 
 		if cut_off_last:
-			generator = zip(self.ratios[:-1], range(len(self.ratios)-1))
+			generator = zip(self.stretch_ratios, range(len(self.ratios)))
 		else:
 			generator = zip(self.ratios, range(len(self.ratios)))
 
 		for ratio, i in generator:
 			wid = int(ratio * self.wid)
-			if cut_off_last and i == len(self.ratios) - 2:
-				wid += int(self.ratios[-1] * self.wid)
+
+			if i == len(self.ratios) - 1:
+				wid = int(self.wid - left + 1)
+
 			try:
 				self.container[i].resize(self.y, left, hei, max(1, wid-1))
 			except KeyError:
 				pass
+
 			left += wid
 	
 	def poke(self):
onfig/aerc.conf?h=0.2.0&id=aeb700577b5b2955c75093129e01de49b92f124f'>^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115