Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] make TERMINFO_DIRS variable special
- X-seq: zsh-workers 39900
- From: Guillaume Maudoux <layus.on@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] make TERMINFO_DIRS variable special
- Date: Wed, 9 Nov 2016 17:14:33 +0100
- Cc: Guillaume Maudoux <layus.on@xxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kMFFWOC6svQe0phDikQ1tmVFuXWB8abYO3HskrAmc1Q=; b=nMEQQfEq+TSBp19bMXP8EJf/7lmhMu2wmtVrWAxkVPhXPDSSc4Fz/LXhMZo6r5a9Gp 6Iykakcd3vkOngIGQ3gk5BhRJCYHGa1uU20xqpVr2IdohBPajcn2j4s4TIgJ2Rq7/9dD xjNoAnHtcU0V9hqQlCN6LqWDFGfg39AX59rfoK44i0rQJ4FE0r0u/ph1JFS5T+/P1ADC 6pGrkm91QDSnrBCgne5QwgMNfz0Oo0g2ynZC2mOsb9xcZPXAGPKl4Sqp01wL5Mz0fjFa to5VdD7/jxMKYzFDqPD4ky0kjIhJwd5y1I8U3WIaG6KcF9Erzfxczuykh2UXOLuagbEb 8vmw==
- In-reply-to: <20161109161433.12584-1-layus.on@gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <12935.1478707087@hydra.kiddle.eu> <20161109161433.12584-1-layus.on@gmail.com>
---
Doc/Zsh/params.yo | 16 ++++++++++++----
Src/params.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index c7d84b9..d9f7103 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -1485,10 +1485,18 @@ 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 seems specific
+to ncurses. Again, 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.
)
vindex(TIMEFMT)
item(tt(TIMEFMT))(
diff --git a/Src/params.c b/Src/params.c
index 19a8c29..92b8ac1 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -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),
@@ -4511,6 +4515,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' */
/**/
--
2.10.1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author