Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Fix needed for new COLUMNS/LINES handling
- X-seq: zsh-workers 2992
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: Fix needed for new COLUMNS/LINES handling
- Date: Fri, 14 Mar 1997 17:29:49 -0800
- Reply-to: schaefer@xxxxxxx
My contribution to the several recent display-handling patches for 3.0.3
and 3.1.x included, among other things, two changes:
(1) Make setintenv() call the pm.ifn routine when changing the parameter;
(2) Use setintenv() to establish $COLUMNS and $LINES in init.c.
I recently installed zsh-3.0.3-test4 with these patches added.  Today I
got this message:
---------- Forwarded message ----------
Subject: New unpleasantness w/zsh
This started happening to me in emacs shell buffers:
  aztec [~/zanshin/src/mac/genesis/rsrc] 99 % ls
  ls: ignoring invalid width in environment variable COLUMNS: 0
after the new zsh was installed.  Any ideas?
----------
I'm not sure whether this means that zsh is exporting COLUMNS and LINES
when it did not do so before, or merely that it is exporting a value that
it did not previously export.  In any case, exporting COLUMNS=0 is a bug.
The absolute minimal fix is to change setintenv():
  /**/
  void
  setintenv(char *s, long val)
  {
      Param pm;
      char buf[DIGBUFSIZE];
  
      if ((pm = (Param) paramtab->getnode(paramtab, s)) && pm->env) {
  	(pm->sets.ifn)(pm, val);
- 	sprintf(buf, "%ld", val);
+ 	sprintf(buf, "%ld", (pm->gets.ifn)(pm));
  	pm->env = replenv(pm->env, buf);
      }
  }
This ought to be done anyway, so that any change to "val" made by sets.ifn
is properly picked up by setintenv.  (Question ... is pm->data guaranteed
to be a (long *) in this case?)
However, we also might want to consider changing init.c so that it does
not modify COLUMNS and LINES at all when the winsize.ws_col or .ws_row
values are zero.  There are cases where values for those variables that
are already in the environment may be more correct.
Final question:  Who is responsible for actually exporting LINES and
COLUMNS?  setintenv() is a no-op if pm->env is false, which means that
COLUMS and LINES won't get set if they aren't already exported.  Is
that really how it should behave?  Or is there something else I missed
that my init.c change has broken?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author