mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-12 01:11:27 +02: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:
parent
368884a3aa
commit
dae21874d4
3 changed files with 49 additions and 4 deletions
|
@ -1,5 +1,9 @@
|
||||||
2016-11-20 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
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:
|
* 39995 (from 39977): Src/params.c, Test/A06assign.ztst:
|
||||||
optimisation of string assignment if length is unchanged.
|
optimisation of string assignment if length is unchanged.
|
||||||
|
|
||||||
|
|
|
@ -1493,10 +1493,20 @@ take effect.
|
||||||
)
|
)
|
||||||
vindex(TERMINFO)
|
vindex(TERMINFO)
|
||||||
item(tt(TERMINFO) <S>)(
|
item(tt(TERMINFO) <S>)(
|
||||||
A reference to a compiled description of the terminal, used by the
|
A reference to your terminfo database, used by the `terminfo' library when the
|
||||||
`terminfo' library when the system has it; see manref(terminfo)(5).
|
system has it; see manref(terminfo)(5).
|
||||||
If set, this causes the shell to reinitialise the terminal, making
|
If set, this causes the shell to reinitialise the terminal, making the
|
||||||
the workaround `tt(TERM=$TERM)' unnecessary.
|
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)
|
vindex(TIMEFMT)
|
||||||
item(tt(TIMEFMT))(
|
item(tt(TIMEFMT))(
|
||||||
|
|
31
Src/params.c
31
Src/params.c
|
@ -87,6 +87,7 @@ char *ifs, /* $IFS */
|
||||||
*postedit, /* $POSTEDIT */
|
*postedit, /* $POSTEDIT */
|
||||||
*term, /* $TERM */
|
*term, /* $TERM */
|
||||||
*zsh_terminfo, /* $TERMINFO */
|
*zsh_terminfo, /* $TERMINFO */
|
||||||
|
*zsh_terminfodirs, /* $TERMINFO_DIRS */
|
||||||
*ttystrname, /* $TTY */
|
*ttystrname, /* $TTY */
|
||||||
*pwd; /* $PWD */
|
*pwd; /* $PWD */
|
||||||
|
|
||||||
|
@ -208,6 +209,8 @@ static const struct gsu_scalar term_gsu =
|
||||||
{ termgetfn, termsetfn, stdunsetfn };
|
{ termgetfn, termsetfn, stdunsetfn };
|
||||||
static const struct gsu_scalar terminfo_gsu =
|
static const struct gsu_scalar terminfo_gsu =
|
||||||
{ terminfogetfn, terminfosetfn, stdunsetfn };
|
{ terminfogetfn, terminfosetfn, stdunsetfn };
|
||||||
|
static const struct gsu_scalar terminfodirs_gsu =
|
||||||
|
{ terminfodirsgetfn, terminfodirssetfn, stdunsetfn };
|
||||||
static const struct gsu_scalar wordchars_gsu =
|
static const struct gsu_scalar wordchars_gsu =
|
||||||
{ wordcharsgetfn, wordcharssetfn, stdunsetfn };
|
{ wordcharsgetfn, wordcharssetfn, stdunsetfn };
|
||||||
static const struct gsu_scalar ifs_gsu =
|
static const struct gsu_scalar ifs_gsu =
|
||||||
|
@ -283,6 +286,7 @@ IPDEF2("histchars", histchars_gsu, PM_DONTIMPORT),
|
||||||
IPDEF2("HOME", home_gsu, PM_UNSET),
|
IPDEF2("HOME", home_gsu, PM_UNSET),
|
||||||
IPDEF2("TERM", term_gsu, PM_UNSET),
|
IPDEF2("TERM", term_gsu, PM_UNSET),
|
||||||
IPDEF2("TERMINFO", terminfo_gsu, PM_UNSET),
|
IPDEF2("TERMINFO", terminfo_gsu, PM_UNSET),
|
||||||
|
IPDEF2("TERMINFO_DIRS", terminfodirs_gsu, PM_UNSET),
|
||||||
IPDEF2("WORDCHARS", wordchars_gsu, 0),
|
IPDEF2("WORDCHARS", wordchars_gsu, 0),
|
||||||
IPDEF2("IFS", ifs_gsu, PM_DONTIMPORT | PM_RESTRICTED),
|
IPDEF2("IFS", ifs_gsu, PM_DONTIMPORT | PM_RESTRICTED),
|
||||||
IPDEF2("_", underscore_gsu, PM_DONTIMPORT),
|
IPDEF2("_", underscore_gsu, PM_DONTIMPORT),
|
||||||
|
@ -4548,6 +4552,33 @@ terminfosetfn(Param pm, char *x)
|
||||||
term_reinit_from_pm();
|
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' */
|
/* Function to get value for special parameter `pipestatus' */
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
|
Loading…
Reference in a new issue