1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-01 05:16:05 +01:00

39900: Add TERMINFO_DIRS special like TERMINFO.

Although this is a colon-separated array there is no tied array.
This commit is contained in:
Guillaume Maudoux 2016-11-09 17:14:33 +01:00 committed by Peter Stephenson
parent 368884a3aa
commit dae21874d4
3 changed files with 49 additions and 4 deletions

View file

@ -1,5 +1,9 @@
2016-11-20 Peter Stephenson <p.w.stephenson@ntlworld.com>
* Guillaume Maudoux: 39900 (doc slightly tweaked): Src/params.c,
Doc/Zsh/params.yo: Add TERMINFO_DIRS special colon-separated
array, not tied.
* 39995 (from 39977): Src/params.c, Test/A06assign.ztst:
optimisation of string assignment if length is unchanged.

View file

@ -1493,10 +1493,20 @@ take effect.
)
vindex(TERMINFO)
item(tt(TERMINFO) <S>)(
A reference to a compiled description of the terminal, used by the
`terminfo' library when the system has it; see manref(terminfo)(5).
If set, this causes the shell to reinitialise the terminal, making
the workaround `tt(TERM=$TERM)' unnecessary.
A reference to your terminfo database, used by the `terminfo' library when the
system has it; see manref(terminfo)(5).
If set, this causes the shell to reinitialise the terminal, making the
workaround `tt(TERM=$TERM)' unnecessary.
)
vindex(TERMINFO_DIRS)
item(tt(TERMINFO_DIRS) <S>)(
A colon-seprarated list of terminfo databases, used by the `terminfo' library
when the system has it; see manref(terminfo)(5). This variable is only
used by certain terminal libraries, in particular ncurses; see
manref(terminfo)(5) to check support on your system. If set, this
causes the shell to reinitialise the terminal, making the workaround
`tt(TERM=$TERM)' unnecessary. Note that unlike other colon-separated
arrays this is not tied to a zsh array.
)
vindex(TIMEFMT)
item(tt(TIMEFMT))(

View file

@ -87,6 +87,7 @@ char *ifs, /* $IFS */
*postedit, /* $POSTEDIT */
*term, /* $TERM */
*zsh_terminfo, /* $TERMINFO */
*zsh_terminfodirs, /* $TERMINFO_DIRS */
*ttystrname, /* $TTY */
*pwd; /* $PWD */
@ -208,6 +209,8 @@ static const struct gsu_scalar term_gsu =
{ termgetfn, termsetfn, stdunsetfn };
static const struct gsu_scalar terminfo_gsu =
{ terminfogetfn, terminfosetfn, stdunsetfn };
static const struct gsu_scalar terminfodirs_gsu =
{ terminfodirsgetfn, terminfodirssetfn, stdunsetfn };
static const struct gsu_scalar wordchars_gsu =
{ wordcharsgetfn, wordcharssetfn, stdunsetfn };
static const struct gsu_scalar ifs_gsu =
@ -283,6 +286,7 @@ IPDEF2("histchars", histchars_gsu, PM_DONTIMPORT),
IPDEF2("HOME", home_gsu, PM_UNSET),
IPDEF2("TERM", term_gsu, PM_UNSET),
IPDEF2("TERMINFO", terminfo_gsu, PM_UNSET),
IPDEF2("TERMINFO_DIRS", terminfodirs_gsu, PM_UNSET),
IPDEF2("WORDCHARS", wordchars_gsu, 0),
IPDEF2("IFS", ifs_gsu, PM_DONTIMPORT | PM_RESTRICTED),
IPDEF2("_", underscore_gsu, PM_DONTIMPORT),
@ -4548,6 +4552,33 @@ terminfosetfn(Param pm, char *x)
term_reinit_from_pm();
}
/* Function to get value of special parameter `TERMINFO_DIRS' */
/**/
char *
terminfodirsgetfn(UNUSED(Param pm))
{
return zsh_terminfodirs ? zsh_terminfodirs : dupstring("");
}
/* Function to set value of special parameter `TERMINFO_DIRS' */
/**/
void
terminfodirssetfn(Param pm, char *x)
{
zsfree(zsh_terminfodirs);
zsh_terminfodirs = x;
/*
* terminfo relies on the value being exported before
* we reinitialise the terminal. This is a bit inefficient.
*/
if ((pm->node.flags & PM_EXPORTED) && x)
addenv(pm, x);
term_reinit_from_pm();
}
/* Function to get value for special parameter `pipestatus' */
/**/