author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | |
Sun, 12 Feb 2012 14:12:32 +0000 (15:12 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 13 Feb 2012 23:08:47 +0000 (15:08 -0800) | ||
commit | ad6c3739a33586ba15a8c5c245dcd59e8a31cef1 | |
tree | 79f132fd18a6fee4f7d87e9c63a79c72baa8cbaf | tree | snapshot |
parent | d0482e88a735787f7bb33ef4783be0e7f6a70946 | commit | diff |
pager: find out the terminal width before spawning the pager
term_columns() checks for terminal width via ioctl(2) on the standard
output, but we spawn the pager too early for this check to be useful.
The effect of this buglet can be observed by opening a wide terminal and
running "git -p help --all", which still shows 80-column output, while
"git help --all" uses the full terminal width. Run the check before we
spawn the pager to fix this.
While at it, move term_columns() to pager.c and export it from cache.h so
that callers other than the help subsystem can use it.
Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
term_columns() checks for terminal width via ioctl(2) on the standard
output, but we spawn the pager too early for this check to be useful.
The effect of this buglet can be observed by opening a wide terminal and
running "git -p help --all", which still shows 80-column output, while
"git help --all" uses the full terminal width. Run the check before we
spawn the pager to fix this.
While at it, move term_columns() to pager.c and export it from cache.h so
that callers other than the help subsystem can use it.
Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h | diff | blob | history | |
help.c | diff | blob | history | |
pager.c | diff | blob | history |