Commit 7e6a3d73 authored by Axel Beckert's avatar Axel Beckert

New upstream release candidate 5.6.2-test-3

Merge branch 'upstream' at 'zsh-5.6.2-test-3' into branch debian
parents feaf8570 325fceab
2018-01-05 dana <dana@dana.is>
* unposted: Config/version.mk, NEWS: Update for 5.6.2-test-3
2018-01-04 dana <dana@dana.is>
* 43974: Completion/Unix/Command/_git: Always offer -F/-m for
`git tag`
* 43970, 43971: Etc/creating-a-release.txt, NEWS: Document some
changes in 5.{4,5,6} not previously mentioned, clarify that
process in release instructions
2019-01-03 Peter Stephenson <p.stephenson@samsung.com>
* 43969: Src/Zle/compctl.c: untokenize Dash for compctl with
GLOB_SUBST set.
2018-01-01 dana <dana@dana.is>
* 43960: Completion/Linux/Command/_setsid,
Completion/Zsh/Command/_exec, Completion/Zsh/Command/_precommand:
Add full completion for exec and setsid
* 43959: Completion/Unix/Command/_ipsec,
Completion/Unix/Command/_swanctl, Completion/Unix/Type/_urls: Add
completion for strongSwan, &al.; complete unix:// URIs
2018-12-31 dana <dana@dana.is>
* 43962: Test/X04zlehighlight.ztst: Fix module_path
2018-12-30 Peter Stephenson <p.w.stephenson@ntlworld.com>
* Sebastian: users/23809: Src/prompt.c,
Test/X04zlehighlight.ztst: Add ZLE_HIGHLITHT extensions to
termcap for colours > 7, add tests.
* 43944: Martijn: Doc/Zsh/options.yo, README, Src/math.c,
Test/C01arith.ztst: apply NO_UNSET consistently to arithmetic.
* unposted: Test/D04parameter.ztst: test for 43938.
2018-12-30 dana <dana@dana.is>
* 43914 (tweaked): Completion/Unix/Command/_composer: Add
completion for Composer
* 43930: Completion/Base/Utility/_multi_parts: Improve performance
* unposted (per 43938): Src/utils.c: Avoid segfault when
unmetafying empty string
2018-12-29 dana <dana@dana.is>
* 43953 (tweaked per 43954): Src/utils.c, Test/V09datetime.ztst:
Fix rounding/truncation error in %. time-format specifier
2018-12-24 dana <dana@dana.is>
* 43935 (tweaked): Src/Modules/datetime.c, Test/V09datetime.ztst:
Fix test error on 32-bit machines, reject too-large nanosecond
values given to strftime
2018-12-23 dana <dana@dana.is>
* 43928: Completion/Base/Utility/_alternative: Evaluate (...)
action syntax as with _arguments
2018-12-21 Bart Schaefer <schaefer@zsh.org>
* 43921: ${\var} should be an error
2018-12-19 Peter Stephenson <p.w.stephenson@ntlworld.com>
* unposted: Config/version.mk, Etc/FAQ.yo, README: update for
......@@ -6960,6 +7033,12 @@
Test/B02typeset.ztst, Test/V10private.ztst: typeset -p
can now output arrays on one line.
* 37303: Test/E01options.ztst: test WARN_CREATE_GLOBAL negative
cases.
* 37302: Src/exec.c, Src/params.c: suppress WARN_CREATE_GLOBAL
warnings after a fork
* unposted: Src/exec.c, Src/init.c: fix up init_io() calls
in previous change.
......
......@@ -43,8 +43,10 @@ while _tags; do
# Anything inside `(...)' is added directly.
eval ws\=\( "${action[2,-2]}" \)
_all_labels "${def%%:*}" expl "$descr" \
compadd "$subopts[@]" - ${=action[2,-2]}
compadd "$subopts[@]" -a - ws
elif [[ "$action" = \{*\} ]]; then
# A string in braces is evaluated.
......
......@@ -127,8 +127,7 @@ while true; do
return
fi
elif (( $#tmp1 )); then
local ret=1 tt
local -a mm
local ret=1
# More than one match. First we get all strings that match the
# rest from the line.
......@@ -145,11 +144,14 @@ while true; do
SUFFIX="$suf"
fi
for tt in $tmp1
do
mm+=( "${(@M)matches:#$tt*}" )
done
matches=( $mm )
# The purpose of this check (or one purpose, anyway) seems to be to ensure
# that the suffix for the current segment on the command line doesn't
# match across segments. For example, we want $matches for a<TAB>c to
# include abc/d, but not abd/c. If we don't have anything on the command
# line for this segment, though, we can skip it. (The difference is only
# noticeable when there are a huge number of possibilities)
[[ -n $pre$suf ]] &&
matches=( ${(@M)matches:#(${(j<|>)~${(@b)tmp1}})*} )
if ! zstyle -t ":completion:${curcontext}:" expand suffix ||
[[ -n "$menu" || -z "$compstate[insert]" ]]; then
......
#compdef setsid
[[ $service == setsid ]] && precommands+=( setsid )
_arguments -s -S -A '-*' : \
'(: * -)'{-h,--help}'[display help information]' \
'(: * -)'{-V,--version}'[display version information]' \
'(-c --ctty)'{-c,--ctty}'[set controlling terminal to current one]' \
'(-f --fork)'{-f,--fork}'[always fork]' \
'(-w --wait)'{-w,--wait}'[wait for program to exit, and use same return code]' \
'1: :_path_commands' \
'*:: : _normal'
This diff is collapsed.
......@@ -2017,15 +2017,6 @@ _git-subtree () {
(( $+functions[_git-tag] )) ||
_git-tag () {
local -a message_opts
if (( words[(I)-[asu]] )); then
message_opts=(
'(-m --message -F --file)'{-m+,--message=}'[specify tag message]:message'
'(-m --message -F --file)'{-F+,--file=}'[read tag message from given file]:message file:_files'
)
fi
_arguments \
- creation \
'(-a --annotate -s --sign -u --local-user)'{-a,--annotate}'[create an unsigned, annotated tag]' \
......@@ -2035,7 +2026,8 @@ _git-tag () {
'(-f --force)'{-f,--force}'[replace existing tag]' \
'--create-reflog[create a reflog]' \
'--cleanup=[cleanup message]:mode:((verbatim\:"no cleanup" whitespace\:"remove leading and trailing whitespace" strip\:"remove leading and trailing whitespace and comments"))' \
$message_opts \
'(-m --message -F --file)'{-F+,--file=}'[read tag message from given file]:message file:_files' \
'(-m --message -F --file)'{-m+,--message=}'[specify tag message]:message' \
': :__git_tags' \
':: :__git_commits' \
- deletion \
......
#compdef ipsec strongswan
# Completion for the ipsec script (aka strongswan on some systems) provided by
# FreeS/WAN, Openswan, Libreswan, and strongSwan. See also strongSwan's swanctl.
#
# As with swanctl, elevated privileges are usually required to complete SA names
# and the like; consider setting the gain-privileges style as follows:
# zstyle ':completion:*:(ipsec|strongswan)/*' gain-privileges yes
#
# @todo We don't complete pool names or virtual IPs
# Complete connection (IKE SA) names and optionally SA/instance names
# --instances => also complete SA/instance names
(( $+functions[_ipsec_connections] )) ||
_ipsec_connections() {
local -a instances tmp ipsec_conns ipsec_insts
zparseopts -D -E -a instances - -instances
tmp=( ${(f)${"$(
_call_program -p ipsec-status ${_ipsec_cmd:-$words[1]} statusall
)"#*$'\n'[[:space:]]#[Cc]onnections:[[:space:]]#$'\n'}} )
tmp=( ${(@M)tmp:#[[:space:]]#[^[:space:]]##:[[:space:]]##?*} )
tmp=( ${(@)${(@)tmp##[[:space:]]##}%%:*} )
ipsec_conns=( ${(@)tmp%%['[{']<->['}]']} )
ipsec_insts=( ${(@M)tmp:#*['[{']<->['}]']} )
(( $#ipsec_conns )) || {
_message -e connections 'connection name'
return
}
tmp=( 'connections:connection name:compadd -a - ipsec_conns' )
(( $#instances && $#ipsec_insts )) &&
tmp+=( 'instances:connection SA/instance name:compadd -a - ipsec_insts' )
_alternative $tmp
}
# Complete arguments to /usr/lib/ipsec/starter. This is rarely invoked directly,
# and there is almost no documentation on it, but the start/restart commands
# pass options to it
(( $+functions[_ipsec_starter] )) ||
_ipsec_starter() {
_arguments : \
'(--nofork)--attach-gdb[start daemon under gdb (implies --nofork)]' \
'--auto-update[specify select time-out]:select time-out (seconds)' \
'--conf[specify path to ipsec.conf]:ipsec.conf file:_files' \
'--daemon[specify daemon name]:daemon name' \
'--nofork[do not fork daemon]' \
+ '(d)' \
'--debug[set log level 2]' \
'--debug-more[set log level 3]' \
'--debug-all[set log level 4]' \
'--nolog[set log level 0]'
}
_ipsec() {
local ret=1 variant _ipsec_cmd=$words[1]
local -a context line state state_descr tmp
local -A opt_args
_pick_variant -r variant \
freeswan='(#i)frees/#wan' \
libreswan='(#i)libreswan' \
openswan='(#i)openswan' \
strongswan='(#i)strongswan' \
unix \
--version
# Provide only basic completion for non-strongSwan implementations
if [[ $variant == unix ]]; then
_default
return
elif [[ $variant == (free|libre|open)* ]]; then
tmp=( ${(f)"$( _call_program ipsec-help $words[1] --help )"} )
tmp=( ${(@M)tmp:#($' '|$'\t')*} )
tmp=( ${(@)tmp:#*[':/<>()[]']*} )
tmp=( ${(f)${(F)tmp//[[:space:]]##/$'\n'}} )
_arguments -S -A '-*' : \
'(: * -)--help[display help information]' \
'(: * -)--version[display version information]' \
"(-)1:command:(${(j< >)${(@q-)tmp}})" \
'(-)2: :_default'
return
fi
_arguments -A '-*' \
'(: * -)--confdir[display path to configuration directory (IPSEC_CONFDIR)]' \
'(: * -)--copyright[display copyright information]' \
'(: * -)--directory[display path to libexec/utility directory (IPSEC_DIR)]' \
'(: * -)--help[display help information]' \
'(: * -)--piddir[display path to PID directory (IPSEC_PIDDIR)]' \
'(: * -)--version[display version information]' \
'(: * -)--versioncode[display brief version information]' \
'1:command:((
down\:"terminate IPsec connection/SA"
down-srcip\:"terminate IKE SAs by client virtual IP"
leases\:"display IP address/pool status"
listaacerts\:"display X.509 authorization authority certificates"
listacerts\:"display X.509 attribute certificates"
listalgs\:"display loaded algorithms"
listall\:"execute all list commands"
listcacerts\:"display X.509 certificate authority certificates"
listcainfos\:"display certificate authority information"
listcerts\:"display X.509/OpenPGP certificates"
listcounters\:"display IKE counter information"
listcrls\:"display certificate revocation lists"
listgroups\:"display groups for user authorization profiles"
listocsp\:"display OCSP revocation information"
listocspcerts\:"display X.509 OCSP signer certificates"
listplugins\:"display loaded plug-in features"
listpubkeys\:"display RSA public keys"
purgecerts\:"purge cached certificates"
purgecrl\:"purge cached certificate revocation lists"
purgeike\:"purge IKE SAs without a quick mode or CHILD_SA"
purgeocsp\:"purge cached OCSP information"
reload\:"reload entire configuration (send SIGUSR1)"
rereadacerts\:"re-read attribute certificates"
rereadaacerts\:"flush and re-read authorization authority certificates"
rereadall\:"execute all re-read commands"
rereadcacerts\:"flush and re-read certificate authority certificates"
rereadcrls\:"re-read certificate revocation lists"
rereadocspcerts\:"re-read OCSP certificates"
rereadsecrets\:"flush and re-read secrets"
resetcounters\:"reset IKE counter information"
restart\:"equivalent to stop + start"
route\:"insert kernel IPsec policy for connection"
start\:"start IKE daemon"
status\:"display concise connection status"
statusall\:"display detailed connection status"
stop\:"terminate all IPsec connections and stop IKE daemon"
stroke\:"issue stroke command"
unroute\:"remove kernel IPsec policy for connection"
up\:"bring up IPsec connection"
update\:"reload changes in configuration (send SIGHUP)"
))' \
'*:: :->next' \
&& ret=0
[[ $state == next ]] &&
case $words[1] in
down)
_arguments : '1: :_ipsec_connections --instances' && ret=0
;;
listcounters|resetcounters|route|status|statusall|unroute|up)
_arguments : '1: :_ipsec_connections' && ret=0
;;
down-srcip)
_arguments : \
'1:virtual IP address (start)' \
'2::virtual IP address (end)' \
&& ret=0
;;
leases)
_arguments : '1:pool name' '2::virtual IP address' && ret=0
;;
list*~list(counters|plugins))
_arguments : '--utc[use UTC for time fields]' && ret=0
;;
start|restart)
_ipsec_starter && ret=0
;;
stroke)
_arguments -s -S -A '-*' \
'(: * -)'{-h,--help}'[display help information]' \
'(-d --daemon)'{-d+,--daemon=}'[specify daemon name]:daemon name' \
'1: :_guard "^-*" "stroke command"' \
'*:stroke command argument:_default' \
&& ret=0
;;
esac
return ret
}
_ipsec "$@"
This diff is collapsed.
......@@ -81,7 +81,7 @@ case "$scheme" in
return
fi
;;
file)
file|unix)
[[ -prefix //(127.0.0.1|localhost)/ ]] && compset -P '//(127.0.0.1|localhost)'
[[ -prefix /// ]] && compset -P //
if ! compset -P //; then
......
#compdef exec
[[ $service == exec ]] && precommands+=( exec )
_arguments -s -S -A '-*' : \
'-a+[set argv\[0\] to specified string]:argv[0] string' \
'-c[clear environment]' \
'-l[simulate login shell (prepend - to argv\[0\])]' \
'*:: : _normal'
#compdef - nohup eval time rusage noglob nocorrect exec catchsegv aoss hilite eatmydata setsid
#compdef - nohup eval time rusage noglob nocorrect catchsegv aoss hilite eatmydata
# precommands is made local in _main_complete
precommands+=($words[1])
......
......@@ -27,5 +27,5 @@
# This must also serve as a shell script, so do not add spaces around the
# `=' signs.
VERSION=5.6.2-test-2
VERSION_DATE='December 19, 2018'
VERSION=5.6.2-test-3
VERSION_DATE='January 5, 2019'
......@@ -2362,6 +2362,8 @@ then all currently active child processes are waited for.
Each var(job) can be either a job specification or the process ID
of a job in the job table.
The exit status from this command is that of the job waited for.
If var(job) represents an unknown job or process ID, a warning is printed
(unless the tt(POSIX_BUILTINS) option is set) and the exit status is 127.
It is possible to wait for recent processes (specified by process ID,
not by job) that were running in the background even if the process has
......
......@@ -753,7 +753,9 @@ pindex(NOUNSET)
cindex(parameters, substituting unset)
cindex(unset parameters, substituting)
item(tt(UNSET) (tt(PLUS()u), ksh: tt(PLUS()u)) <K> <S> <Z>)(
Treat unset parameters as if they were empty when substituting.
Treat unset parameters as if they were empty when substituting, and as if
they were zero when reading their values in arithmetic expansion and
arithmetic commands.
Otherwise they are treated as an error.
)
pindex(WARN_CREATE_GLOBAL)
......
......@@ -11,6 +11,10 @@ To create a zsh release:
README
NEWS
README should document compatibility-breaking changes. Generally, NEWS should
document new features and major bug fixes (but not routine fixes or changes to
completion/contrib functions).
- Commit those changes with an "unposted" ChangeLog entry.
git commit -am "Test release: 5.5.1-test-1." &&
......
......@@ -13,6 +13,10 @@ highlighting. On 88 and 256 colour terminals, a new zsh/nearcolor module
allows colours specified with hex triplets to be matched against the
nearest available colour.
The zsh/datetime module's strftime builtin now accepts an argument
specifying the nanoseconds time component; both arguments can be omitted
to use the current time.
Changes from 5.6.1 to 5.6.2
---------------------------
......@@ -63,13 +67,23 @@ In shell patterns, [[:blank:]] now honours the locale instead of
matching exclusively on space and tab, like for the other POSIX
character classes or for extended regular expressions.
Nanosecond precision on file times is supported in the module
The zsh/system module now provides the PID of the last process
substitution via $sysparams[procsubstpid].
Time formatting via the %D prompt escape now offers nanosecond
precision with the %. and %N format specifiers. Additionally,
nanosecond precision on file times is supported in the module
zsh/stat.
The zsh/mathfunc module now includes a log2() function.
The parameter ZLE_RECURSIVE has been added to indicate the
current ZLE recursion level.
Changes from 5.5 to 5.5.1
-------------------------
Apart from a fix for a configuration problem finding singal names from
Apart from a fix for a configuration problem finding signal names from
(some) recent versions of glibc, there are only minor changes.
Changes from 5.4.2 to 5.5
......@@ -89,9 +103,19 @@ typeset -A assoc=([key1]=val1 [key2]=val2)
is allowed for compatibility with other shells. In the case of normal
arrays the new syntax can be mixed with the old.
The %E, %S, and %U TIMEFMT specifiers now support m and u prefixes
(e.g., %mE) to output times in milliseconds and microseconds,
respectively.
The option CHECK_RUNNING_JOBS was added to control whether zsh should
check for running jobs in addition to suspended ones with CHECK_JOBS.
It is enabled by default.
Changes from 5.3.1 to 5.4.2
---------------------------
There are only minor changes between 5.4 and 5.4.2.
The 'exec' and 'command' precommand modifiers, and options to them, are
now parsed after parameter expansion. Previously, both the modifier and
any options to it were parsed between alias expansion and parameter
......@@ -111,6 +135,13 @@ turned on for an individual function with "functions -W".
zmodload now has an option -s to be silent on a failure to find a module
but still print other errors.
The autoload builtin gained several new features to load functions from a
file path determined at the time of definition rather than at the time of
loading.
The zsh/parameter module now exposes the file paths associated with
shell functions via the parameters functions_source and
dis_functions_source.
Changes from 5.2 to 5.3.1
-------------------------
......
......@@ -42,6 +42,10 @@ array.
The gen-applied-string hook is unaffected; it still receives the patches in
reverse order, from last applied to first applied.
2) The option NO_UNSET now also applies when reading values from
variables without a preceding '$' sign in shell arithmetic expansion
and in the double-parentheses and 'let' arithmetic commands.
Incompatibilities between 5.5.1 and 5.6.2
------------------------------------------
......
......@@ -148,7 +148,7 @@ output_strftime(char *nam, char **argv, Options ops, UNUSED(int func))
} else if (*argv[2] == '\0' || *endptr != '\0') {
zwarnnam(nam, "%s: invalid decimal number", argv[2]);
return 1;
} else if (ts.tv_nsec < 0) {
} else if (ts.tv_nsec < 0 || ts.tv_nsec > 999999999) {
zwarnnam(nam, "%s: invalid nanosecond value", argv[2]);
return 1;
}
......
......@@ -3256,6 +3256,15 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
rpl = strlen(rpre);
rsl = strlen(rsuf);
}
else
{
for (p = rpre; *p; ++p)
if (*p == Dash)
*p = '-';
for (p = rsuf; *p; ++p)
if (*p == Dash)
*p = '-';
}
untokenize(lpre);
untokenize(lsuf);
......
......@@ -1910,7 +1910,7 @@ getjob(const char *s, const char *prog)
/* "%%", "%+" and "%" all represent the current job */
if (*s == '%' || *s == '+' || !*s) {
if (curjob == -1) {
if (prog)
if (prog && !isset(POSIXBUILTINS))
zwarnnam(prog, "no current job");
returnval = -1;
goto done;
......@@ -1921,7 +1921,7 @@ getjob(const char *s, const char *prog)
/* "%-" represents the previous job */
if (*s == '-') {
if (prevjob == -1) {
if (prog)
if (prog && !isset(POSIXBUILTINS))
zwarnnam(prog, "no previous job");
returnval = -1;
goto done;
......@@ -1944,7 +1944,7 @@ getjob(const char *s, const char *prog)
returnval = jobnum;
goto done;
}
if (prog)
if (prog && !isset(POSIXBUILTINS))
zwarnnam(prog, "%%%s: no such job", s);
returnval = -1;
goto done;
......@@ -1962,7 +1962,7 @@ getjob(const char *s, const char *prog)
returnval = jobnum;
goto done;
}
if (prog)
if (prog && !isset(POSIXBUILTINS))
zwarnnam(prog, "job not found: %s", s);
returnval = -1;
goto done;
......@@ -1976,7 +1976,8 @@ getjob(const char *s, const char *prog)
}
/* if we get here, it is because none of the above succeeded and went
to done */
zwarnnam(prog, "job not found: %s", s);
if (!isset(POSIXBUILTINS))
zwarnnam(prog, "job not found: %s", s);
returnval = -1;
done:
return returnval;
......@@ -2375,9 +2376,10 @@ bin_fg(char *name, char **argv, Options ops, int func)
}
}
} else if ((retval = getbgstatus(pid)) < 0) {
zwarnnam(name, "pid %d is not a child of this shell", pid);
if (!isset(POSIXBUILTINS))
zwarnnam(name, "pid %d is not a child of this shell", pid);
/* presumably lastval2 doesn't tell us a heck of a lot? */
retval = 1;
retval = 127;
}
thisjob = ocj;
continue;
......@@ -2391,15 +2393,16 @@ bin_fg(char *name, char **argv, Options ops, int func)
job = (*argv) ? getjob(*argv, name) : firstjob;
firstjob = -1;
if (job == -1) {
retval = 1;
retval = 127;
break;
}
jstat = oldjobtab ? oldjobtab[job].stat : jobtab[job].stat;
if (!(jstat & STAT_INUSE) ||
(jstat & STAT_NOPRINT)) {
zwarnnam(name, "%s: no such job", *argv);
if (!isset(POSIXBUILTINS))
zwarnnam(name, "%s: no such job", *argv);
unqueue_signals();
return 1;
return 127;
}
/* If AUTO_CONTINUE is set (automatically make stopped jobs running
* on disown), we actually do a bg and then delete the job table entry. */
......
......@@ -342,6 +342,8 @@ getmathparam(struct mathvalue *mptr)
mptr->pval = (Value)zhalloc(sizeof(struct value));
if (!getvalue(mptr->pval, &s, 1))
{
if (unset(UNSET))
zerr("%s: parameter not set", mptr->lval);
mptr->pval = NULL;
if (isset(FORCEFLOAT)) {
result.type = MN_FLOAT;
......
......@@ -1764,7 +1764,12 @@ output_colour(int colour, int fg_bg, int use_tc, int truecol, char *buf)
/* length of hex triplet always 7, don't need sprintf to count */
atrlen += buf ? sprintf(ptr, "#%02x%02x%02x", colour >> 16,
(colour >> 8) & 0xff, colour & 0xff) : 7;
/* colour should only be > 7 if using termcap but let's be safe */
/* colour should only be > 7 if using termcap but let's be safe. Update:
* currently other places in code don't always imply that colour > 7 =>
* using-termcap - if zle_highlight will be non-default, then it will be
* used instead of termcap even for colour > 7. Here this just emits the
* color number, so it works fine for both zle_highlight and tercap cases
*/
} else if (use_tc || colour > 7) {
char digbuf[DIGBUFSIZE];
sprintf(digbuf, "%d", colour);
......@@ -1995,6 +2000,7 @@ set_colour_attribute(zattr atr, int fg_bg, int flags)
char *ptr;
int do_free, is_prompt = (flags & TSC_PROMPT) ? 1 : 0;
int colour, tc, def, use_termcap, use_truecolor;
int is_default_zle_highlight = 1;
if (fg_bg == COL_SEQ_FG) {
colour = txtchangeget(atr, TXT_ATTR_FG_COL);
......@@ -2010,6 +2016,15 @@ set_colour_attribute(zattr atr, int fg_bg, int flags)
use_termcap = txtchangeisset(atr, TXT_ATTR_BG_TERMCAP);
}
/* Test if current zle_highlight settings are customized, or
* the typical "standard" codes */
if (0 != strcmp(fg_bg_sequences[fg_bg].start, fg_bg == COL_SEQ_FG ? "\e[3" : "\e[4") ||
0 != strcmp(fg_bg_sequences[fg_bg].def, "9") || /* the same in-fix for both FG and BG */
0 != strcmp(fg_bg_sequences[fg_bg].end, "m") /* the same suffix for both FG and BG */
) {
is_default_zle_highlight = 0;
}
/*
* If we're not restoring the default, and either have a
* colour value that is too large for ANSI, or have been told
......@@ -2020,7 +2035,7 @@ set_colour_attribute(zattr atr, int fg_bg, int flags)
* highlighting variables, so much of this shouldn't be
* necessary at this point, but we might as well be safe.
*/
if (!def && !use_truecolor && (colour > 7 || use_termcap)) {
if (!def && !use_truecolor && (is_default_zle_highlight && (colour > 7 || use_termcap))) {
/*
* We can if it's available, and either we couldn't get
* the maximum number of colours, or the colour is in range.
......@@ -2046,9 +2061,10 @@ set_colour_attribute(zattr atr, int fg_bg, int flags)
}
/*
* Nope, that didn't work.
* If 0 to 7, assume standard ANSI works, otherwise it won't.
* If 0 to 7, assume standard ANSI works, if 8 to 255, assume
* typical 256-color escapes works, otherwise it won't.
*/
if (colour > 7)
if (colour > 255)
return;
}
......@@ -2057,6 +2073,10 @@ set_colour_attribute(zattr atr, int fg_bg, int flags)
allocate_colour_buffer();
}
/* Build the reset-code: .start + .def + . end
* or the typical true-color code: .start + 8;2;%d;%d;%d + .end
* or the typical 256-color code: .start + 8;5;%d + .end
*/
strcpy(colseq_buf, fg_bg_sequences[fg_bg].start);
ptr = colseq_buf + strlen(colseq_buf);
......@@ -2067,6 +2087,8 @@ set_colour_attribute(zattr atr, int fg_bg, int flags)
} else if (use_truecolor) {
ptr += sprintf(ptr, "8;2;%d;%d;%d", colour >> 16,
(colour >> 8) & 0xff, colour & 0xff);
} else if (colour > 7 && colour <= 255) {
ptr += sprintf(ptr, "8;5;%d", colour);
} else
*ptr++ = colour + '0';
strcpy(ptr, fg_bg_sequences[fg_bg].end);
......
......@@ -2338,7 +2338,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
zerr("bad substitution");
return NULL;
}
} else if (inbrace && inull(*s)) {
} else if (inbrace && inull(*s) && *s != Bnull) {
/*
* Handles things like ${(f)"$(<file)"} by skipping
* the double quotes. We don't need to know what was
......
......@@ -3334,19 +3334,28 @@ morefmt:
#endif
switch (*fmt++) {
case '.':
if (ztrftimebuf(&bufsize, digs))
return -1;
{
long fnsec = nsec;
if (digs > 9)
digs = 9;
if (ztrftimebuf(&bufsize, digs))
return -1;
if (digs < 9) {
int trunc;
for (trunc = 8 - digs; trunc; trunc--)
nsec /= 10;
nsec = (nsec + 8) / 10;
long max = 100000000;
for (trunc = 8 - digs; trunc; trunc--) {
max /= 10;
fnsec /= 10;
}
max -= 1;
fnsec = (fnsec + 5) / 10;
if (fnsec > max)
fnsec = max;
}
sprintf(buf, "%0*ld", digs, nsec);
sprintf(buf, "%0*ld", digs, fnsec);
buf += digs;
break;
}
case '\0':
/* Guard against premature end of string */
*buf++ = '%';
......@@ -3837,7 +3846,7 @@ sepjoin(char **s, char *sep, int heap)
char sepbuf[2];
if (!*s)
return heap ? "" : ztrdup("");
return heap ? dupstring("") : ztrdup("");
if (!sep) {
/* optimise common case that ifs[0] is space */
if (ifs && *ifs != ' ') {
......
......@@ -341,3 +341,56 @@ F:anonymous function, and a descriptor leak when backgrounding a pipeline
>17
>19
# Test 'wait' for unknown job/process ID.
wait 1
echo $?
wait %%
echo $?
wait %+
echo $?
wait %-