Skip to content

Commit 37acbc8

Browse files
author
Oliver Kiddle
committed
53372, 53375: query terminal properties on ZLE startup
1 parent 0d76a82 commit 37acbc8

File tree

7 files changed

+682
-1
lines changed

7 files changed

+682
-1
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2025-11-10 Oliver Kiddle <opk@zsh.org>
2+
3+
* 53372, 53375: Doc/Zsh/params.yo, Src/Zle/termquery.c,
4+
Src/Zle/zle.mdd, Src/Zle/zle_main.c, Test/X04zlehighlight.ztst,
5+
Test/X06termquery.ztst: query terminal properties on ZLE startup
6+
17
2025-11-09 Bart Schaefer <schaefer@zsh.org>
28

39
* Philippe: 54057: Src/params.c, Src/zsh.h, Test/K01nameref.ztst:

Doc/Zsh/params.yo

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,40 @@ there is a block of reserved or unused signal numbers before the POSIX
965965
real-time signals so the array index can't be used as an accurate indicator
966966
of their signal number. Use, for example, tt(kill -l SIGRTMIN) instead.
967967
)
968+
vindex(.term.bg)
969+
item(tt(.term.bg))(
970+
The background color of the terminal if the terminal supports the
971+
necessary interface for retrieving this information.
972+
973+
See also the tt(.term.extensions) parameter.
974+
)
975+
vindex(.term.fg)
976+
item(tt(.term.fg))(
977+
Like tt(.term.bg) but for the foreground color.
978+
)
979+
vindex(.term.id)
980+
item(tt(.term.id))(
981+
Like the tt(TERM) parameter, this identifies the terminal but is obtained by
982+
querying the terminal. Many terminals name a different common terminal in
983+
tt(TERM) that they then emulate, often imperfectly. This allows them to work
984+
without the need to distribute updates to terminal capability databases. The
985+
more accurate identification in this parameter may be useful when configuring
986+
aspects of the shell differently for specific terminals.
987+
988+
See also the tt(.term.extensions) parameter.
989+
)
990+
vindex(.term.version)
991+
item(tt(.term.version))(
992+
The version number of the terminal application, set in conjunction with
993+
tt(.term.id).
994+
)
995+
vindex(.term.mode)
996+
item(tt(.term.mode))(
997+
Either tt(light) or tt(dark). In cases where the terminal background color is
998+
detected and set in tt(.term.bg), this is set to provide a basic indication of
999+
how light that color is. This may help with configuring readable color
1000+
combinations.
1001+
)
9681002
vindex(TRY_BLOCK_ERROR)
9691003
item(tt(TRY_BLOCK_ERROR) <S>)(
9701004
In an tt(always) block, indicates whether the preceding list of code
@@ -1695,6 +1729,43 @@ causes the shell to reinitialise the terminal, making the workaround
16951729
`tt(TERM=$TERM)' unnecessary. Note that unlike other colon-separated
16961730
arrays this is not tied to a zsh array.
16971731
)
1732+
vindex(.term.extensions)
1733+
item(tt(.term.extensions))(
1734+
An array containing a list of extension features of the terminal to be enabled
1735+
or disabled (prefixed with `tt(-)'). When ZLE starts, it will add entries for
1736+
features that were auto-detected. This auto-detection uses extensions itself,
1737+
all named with a `tt(query)' prefix. As these are used when ZLE starts they
1738+
would need to be disabled early in the startup files if they are to be
1739+
disabled. A value of `tt(-query)' will disable all terminal queries on
1740+
startup. Extensions can be any of the following, where the marks `<D>' and
1741+
`<E>' indicate whether they are disabled or enabled by default:
1742+
1743+
startitem()
1744+
item(tt(query-bg) <E>)(
1745+
Query the terminal background color which is used for tt(.term.bg) and
1746+
tt(.term.mode).
1747+
)
1748+
item(tt(query-fg) <E>)(
1749+
Query the terminal foreground color which is used for tt(.term.fg).
1750+
)
1751+
item(tt(query-id) <E>)(
1752+
Query the terminal identification which is used for tt(.term.id) and
1753+
tt(.term.version).
1754+
)
1755+
xitem(tt(modkeys-kitty) <D>)
1756+
item(tt(query-modkeys-kitty) <E>)(
1757+
Support for the kitty keyboard handling protocol which enables reporting of a
1758+
wider range of key combinations and resolves problems with ambiguous key
1759+
sequences. Currently there is only support for detecting whether the terminal
1760+
supports this feature.
1761+
)
1762+
xitem(tt(truecolor) <E>)
1763+
item(tt(query-truecolor) <E>)(
1764+
Support for 24-bit truecolor escape sequences. Auto-detection also tries
1765+
termcap and the tt(COLORTERM) environment variable.
1766+
)
1767+
enditem()
1768+
)
16981769
vindex(TIMEFMT)
16991770
item(tt(TIMEFMT))(
17001771
The format of process time reports with the tt(time) keyword.

0 commit comments

Comments
 (0)