On Wed, Jun 11, 2014 at 09:54:33AM -0400, Douglas Philips wrote:
> Looks like a shell issue.
> If you don't 'export COLUMNS' it won't be available except to the shell
> itself.
> When you set the value on the command line prior to the command, it is
> exported
> to the environment just for that command.
Yep, that's indeed the problem: COLUMNS is not exported by default (at
least not in bash). But given that the purpose of such a default is
being "sane" and not requiring the users to do any customization, I
suspect that relying on users exporting COLUMNS would be quite
pointless.
An alternative to relying on the COLUMNS envvar is to use ncurses. The
following would work in shell script:
cols=$(tput cols)
lines=$(tput lines)
echo "${cols}x${lines}"
and, e.g., gives "191x57" on my terminal.
(The tput command is shipped by the ncurses-bin package in Debian(-like)
distros.)
However, implementing the above in ledger would require either launching
tput an external command (which is not particularly nice) or linking to
ncurses. If ledger aims at providing a usable interactive cmdline
interface, I think linking ncurses would be acceptable, but that's for
the ledger maintainers to judge.
In the meantime, as I already have a bin/ledger shell script driver in
all my ledger projects, I'll add in there the tput trick above.
Cheers.
--
Stefano Zacchiroli . . . . . . . [email protected] . . . . o . . . o . o
Maître de conférences . . . . . http://upsilon.cc/zack . . . o . . . o o
Former Debian Project Leader . . @zack on identi.ca . . o o o . . . o .
« the first rule of tautology club is the first rule of tautology club »
--
---
You received this message because you are subscribed to the Google Groups
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.