fatty 0.99.3 → 0.99.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fatty/progress.rb +5 -1
- data/lib/fatty/session/modal_session.rb +10 -1
- data/lib/fatty/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6ba7cbd31b6e1928863864a70182cd399e93382b779f48d1f8c7216ba4b39e1b
|
|
4
|
+
data.tar.gz: 33539e70de07caec28311895153471e83477f584656f89b2643636e0dbee33fc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f3832c280838386b3e7a0ecccd6c527c1ec33edc1deaf8ec8e866f24963787e00e3dd6a2ba5083614da17e4875075d5b12fbfccc0dfad6f7efbf0759ab67fbf6
|
|
7
|
+
data.tar.gz: b540ef445b1c318f389adf4e72efdb3d95f4a0410531a74863812a122dcb79b6f02dbe63890ec4d6902ee96b5678055db84a20b4878ae4145d1d1aa6c4f4c9c0
|
data/lib/fatty/progress.rb
CHANGED
|
@@ -104,10 +104,14 @@ module Fatty
|
|
|
104
104
|
text.empty? ? DEFAULT_LABEL : text
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
+
# Return the total but not less than 1 to avoid division-by-zero errors
|
|
108
|
+
# when calculating percentages.
|
|
107
109
|
def normalize_total(value)
|
|
108
110
|
return if value.nil?
|
|
109
111
|
|
|
110
|
-
Integer(value, exception: false)
|
|
112
|
+
val = Integer(value, exception: false)
|
|
113
|
+
val = 1 unless val
|
|
114
|
+
[1, val].max
|
|
111
115
|
end
|
|
112
116
|
|
|
113
117
|
def normalize_style(value)
|
|
@@ -34,9 +34,18 @@ module Fatty
|
|
|
34
34
|
cols = ::Curses.cols
|
|
35
35
|
rows = ::Curses.lines
|
|
36
36
|
width, height = geometry(cols: cols, rows: rows)
|
|
37
|
+
|
|
38
|
+
# Center the popup horizontally
|
|
37
39
|
x = (cols - width) / 2
|
|
40
|
+
|
|
41
|
+
# Put the bottom of the popup window one row above the top of the status
|
|
42
|
+
# area.
|
|
38
43
|
input_row = renderer.screen.input_rect.row
|
|
39
|
-
|
|
44
|
+
status_rows =
|
|
45
|
+
Fatty::Config.config.dig(:status, :max_rows)&.to_i ||
|
|
46
|
+
StatusSession::DEFAULT_MAX_ROWS
|
|
47
|
+
y = [input_row - status_rows - height - 1, 0].max
|
|
48
|
+
|
|
40
49
|
self.win = ::Curses::Window.new(height, width, y, x)
|
|
41
50
|
nil
|
|
42
51
|
end
|
data/lib/fatty/version.rb
CHANGED