summaryrefslogtreecommitdiffstats
path: root/Src/init.c
diff options
context:
space:
mode:
authordana <dana@dana.is>2026-06-05 04:23:29 +0000
committerdana <dana@dana.is>2026-06-08 21:11:58 -0500
commitd7da0f59fc86f1e5d6465ea0b0ca4b93d6a31d54 (patch)
tree0bcecbba5e44e1ae524a74302c1abac40b6dc8ec /Src/init.c
parentunposted: NEWS: fix 5.9 changes header (diff)
downloadzsh-d7da0f59fc86f1e5d6465ea0b0ca4b93d6a31d54.tar
zsh-d7da0f59fc86f1e5d6465ea0b0ca4b93d6a31d54.tar.gz
zsh-d7da0f59fc86f1e5d6465ea0b0ca4b93d6a31d54.tar.bz2
zsh-d7da0f59fc86f1e5d6465ea0b0ca4b93d6a31d54.tar.lz
zsh-d7da0f59fc86f1e5d6465ea0b0ca4b93d6a31d54.tar.xz
zsh-d7da0f59fc86f1e5d6465ea0b0ca4b93d6a31d54.tar.zst
zsh-d7da0f59fc86f1e5d6465ea0b0ca4b93d6a31d54.zip
54676: preserve COLUMNS + LINES from the environment
Diffstat (limited to 'Src/init.c')
-rw-r--r--Src/init.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Src/init.c b/Src/init.c
index eb34b4cab..f36bc332b 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -1288,6 +1288,23 @@ setupvals(char *cmd, char *runscript, char *zsh_name)
condtab = NULL;
wrappers = NULL;
+ zterm_columns_preserve = zterm_lines_preserve = 0;
+
+ // preserve COLUMNS and LINES from environment when non-interactive
+ if (!isset(INTERACTIVE)) {
+ char *e, *p;
+ zlong v;
+
+ if ((e = zgetenv("COLUMNS")) && (v = zstrtol(e, &p, 10)) > 0 && !*p) {
+ zterm_columns = v;
+ zterm_columns_preserve = 1;
+ }
+ if ((e = zgetenv("LINES")) && (v = zstrtol(e, &p, 10)) > 0 && !*p) {
+ zterm_lines = v;
+ zterm_lines_preserve = 1;
+ }
+ }
+
#ifdef TIOCGWINSZ
adjustwinsize(0);
#else