Mercurial > prosody-hg
diff util/human/io.lua @ 13047:d939bf469057
util.human.io: Prefer using the $COLUMNS environment variable if set (by readline)
Feels like it should be faster.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 07 Apr 2023 13:42:20 +0200 |
| parents | da0b3cb9a2ec |
| children | 946442df65d3 |
line wrap: on
line diff
--- a/util/human/io.lua Fri Apr 07 13:38:59 2023 +0200 +++ b/util/human/io.lua Fri Apr 07 13:42:20 2023 +0200 @@ -109,6 +109,8 @@ end local function term_width(default) + local env_cols = os.getenv "COLUMNS"; + if env_cols then return env_cols; end local stty = io.popen("stty -a"); if not stty then return default; end local result = stty:read("*a");
