zsh-workers
 help / color / mirror / code / Atom feed
* patch to make $TERMINFO special
@ 2011-05-08 20:13 Danek Duvall
  2011-05-09 11:16 ` Peter Stephenson
  0 siblings, 1 reply; 8+ messages in thread
From: Danek Duvall @ 2011-05-08 20:13 UTC (permalink / raw)
  To: zsh-workers

I'm sure I'm going about this the wrong way, but at least it seems to work ...

My problem is that I'm using a value of $TERM that's not present in the
system's terminfo database, so when zsh starts up, its terminal handling is
pretty confused.

I'd like to be able to set TERMINFO to the proper path, but in order for
that to do anything, the terminal needs to be reinitialized.  So I've made
TERMINFO a special variable that calls init_term() when it's set, and it
seems to work okay.  I'm guessing that the addenv() call isn't necessary,
but I can't figure out how it ought to work.

    --- zsh-4.3.10/Src/params.c	Fri May  8 02:45:13 2009
    +++ zsh-4.3.10/Src/params.c	Sun May  8 13:09:53 2011
    @@ -198,6 +198,8 @@
     { homegetfn, homesetfn, stdunsetfn };
     static const struct gsu_scalar term_gsu =
     { termgetfn, termsetfn, stdunsetfn };
    +static const struct gsu_scalar terminfo_gsu =
    +{ strgetfn, terminfosetfn, stdunsetfn };
     static const struct gsu_scalar wordchars_gsu =
     { wordcharsgetfn, wordcharssetfn, stdunsetfn };
     static const struct gsu_scalar ifs_gsu =
    @@ -270,6 +272,7 @@
     IPDEF2("histchars", histchars_gsu, PM_DONTIMPORT),
     IPDEF2("HOME", home_gsu, PM_UNSET),
     IPDEF2("TERM", term_gsu, 0),
    +IPDEF2("TERMINFO", terminfo_gsu, 0),
     IPDEF2("WORDCHARS", wordchars_gsu, 0),
     IPDEF2("IFS", ifs_gsu, PM_DONTIMPORT),
     IPDEF2("_", underscore_gsu, PM_READONLY),
    @@ -3943,6 +3946,22 @@
         term = x ? x : ztrdup("");
     
         /* If non-interactive, delay setting up term till we need it. */
    +    if (unset(INTERACTIVE) || !*term)
    +	termflags |= TERM_UNKNOWN;
    +    else 
    +	init_term();
    +}
    +
    +/* Function to set value of special parameter `TERMINFO' */
    +
    +/**/
    +void
    +terminfosetfn(Param pm, char *x)
    +{
    +    strsetfn(pm, x);
    +    addenv(pm, x);
    +
    +    /* If non-interactive, delay setting up term till we need it. */
         if (unset(INTERACTIVE) || !*term)
            termflags |= TERM_UNKNOWN;
         else 

All comments appreciated.

Thanks,
Danek


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-05-10 16:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-08 20:13 patch to make $TERMINFO special Danek Duvall
2011-05-09 11:16 ` Peter Stephenson
2011-05-09 15:51   ` Danek Duvall
2011-05-09 16:20     ` Peter Stephenson
2011-05-09 16:23       ` Danek Duvall
2011-05-09 17:02         ` Peter Stephenson
2011-05-09 17:16           ` Danek Duvall
2011-05-10 15:42             ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).