summaryrefslogtreecommitdiffstats
path: root/main/apk-tools/0003-state-make-the-progress-bar-look-nice.patch
blob: 5dbedc3a2451c35ad266e027b77917c9a0c855dc (plain)
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
From 762e0c717bcae8c2d0f46ba4f35232b773ac8419 Mon Sep 17 00:00:00 2001
From: William Pitcock <nenolod@dereferenced.org>
Date: Sat, 9 Apr 2011 08:16:46 -0500
Subject: [PATCH 3/7] state: make the progress bar look nice

---
 src/state.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/state.c b/src/state.c
index cbc0f25..6de3629 100644
--- a/src/state.c
+++ b/src/state.c
@@ -712,15 +712,15 @@ static void apk_count_change(struct apk_change *change, struct apk_stats *stats)
 
 static void apk_draw_progress(int percent)
 {
-	const int bar_width = (apk_screen_width - 15);
+	const int bar_width = (apk_screen_width - 7);
 	int i;
 
-	fputs("\e7-[", stderr);
+	fprintf(stderr, "\e7%3i%% [", percent);
 	for (i = 0; i < bar_width * percent / 100; i++)
 		fputc('#', stderr);
 	for (; i < bar_width; i++)
 		fputc(' ', stderr);
-	fprintf(stderr, "]- %3i%%", percent);
+	fputc(']', stderr);
 	fflush(stderr);
 	fputs("\e8\e[0K", stderr);
 }
-- 
1.7.4.5