Cache some syscalls (and env check) and declare default values in an imo better way.
Justification for caching: these values change really rarely, but one of them introduces a syscall, which makes strace's of programs using this a bit more annoying to read. I also think that allowing the user to override them is a good idea (in case the user encounters additional broken terminals but doesn't want to patch this package).
The last changed section is mostly a style change, but I found this variant easier to understand.
Cache some syscalls (and env check) and declare default values in an imo better way.
Justification for caching: these values change really rarely, but one of them introduces a syscall, which makes
strace
's of programs using this a bit more annoying to read. I also think that allowing the user to override them is a good idea (in case the user encounters additional broken terminals but doesn't want to patch this package).The last changed section is mostly a style change, but I found this variant easier to understand.