summaryrefslogtreecommitdiff
path: root/pager.c
diff options
context:
space:
mode:
Diffstat (limited to 'pager.c')
-rw-r--r--pager.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/pager.c b/pager.c
index 92b23e6..226828f 100644
--- a/pager.c
+++ b/pager.c
@@ -109,10 +109,15 @@ void setup_pager(void)
return;
/*
- * force computing the width of the terminal before we redirect
- * the standard output to the pager.
+ * After we redirect standard output, we won't be able to use an ioctl
+ * to get the terminal size. Let's grab it now, and then set $COLUMNS
+ * to communicate it to any sub-processes.
*/
- (void) term_columns();
+ {
+ char buf[64];
+ xsnprintf(buf, sizeof(buf), "%d", term_columns());
+ setenv("COLUMNS", buf, 0);
+ }
setenv("GIT_PAGER_IN_USE", "true", 1);