summaryrefslogtreecommitdiff
path: root/pager.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-02-20 00:15:11 -0800
committerJunio C Hamano <gitster@pobox.com>2012-02-20 00:15:11 -0800
commit4d9e079e826c9b51b610260564111fa8385f7581 (patch)
tree13a4e3a16efd510b3b15a2ce55cf3caeb00857aa /pager.c
parent583c389e7e431583de4fd8f6c06495a9b015c528 (diff)
parentec7ff5ba272b565ed093a98dc13dd5cd26aeac92 (diff)
downloadgit-4d9e079e826c9b51b610260564111fa8385f7581.tar.gz
Merge branch 'zj/decimal-width'
* zj/decimal-width: make lineno_width() from blame reusable for others Conflicts: cache.h pager.c
Diffstat (limited to 'pager.c')
-rw-r--r--pager.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/pager.c b/pager.c
index b7909678f4..05584dead6 100644
--- a/pager.c
+++ b/pager.c
@@ -147,3 +147,15 @@ int term_columns(void)
return term_columns_at_startup;
}
+
+/*
+ * How many columns do we need to show this number in decimal?
+ */
+int decimal_width(int number)
+{
+ int i, width;
+
+ for (width = 1, i = 10; i <= number; width++)
+ i *= 10;
+ return width;
+}