1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-07-15 06:01:26 +02:00
Commit graph

224 commits

Author SHA1 Message Date
Barton E. Schaefer
f7c3aa170b 39019 (cf. PWS 39013): fix SHWORDSPLIT regression introduced by workers/29313
Also add test cases for more join/split combinations
2016-08-10 18:33:04 -07:00
Daniel Shahaf
1a368bf31f 38973: Optimize indexing array parameters.
% () { for 1 in $prefix/zsh/bin/zsh Src/zsh; do $1 -f -c 'a=( {1..1000000} ); repeat 3 time ( repeat 300 : $a[1]  )'; done }
( repeat 300; do; : $a[1]; done; )  1.68s user 0.01s system 98% cpu 1.718 total
( repeat 300; do; : $a[1]; done; )  1.69s user 0.01s system 99% cpu 1.710 total
( repeat 300; do; : $a[1]; done; )  1.69s user 0.01s system 99% cpu 1.714 total

( repeat 300; do; : $a[1]; done; )  0.00s user 0.01s system 72% cpu 0.022 total
( repeat 300; do; : $a[1]; done; )  0.00s user 0.01s system 72% cpu 0.022 total
( repeat 300; do; : $a[1]; done; )  0.01s user 0.01s system 69% cpu 0.023 total
2016-08-01 08:01:28 +00:00
Barton E. Schaefer
984c18048b 38599: skip the "no such named directory" warning when NO_EXEC is in effect 2016-06-04 09:51:23 -07:00
Daniel Shahaf
9e7cefcc95 unposted: internal: Document modify(). 2016-06-03 20:39:25 +00:00
Peter Stephenson
dc2397f754 users/21352: ensure $'' doesn't get elided.
Assign nulstring to it if empty.  Test for all forms of quotation
marks.
2016-03-07 09:44:54 +00:00
Peter Stephenson
f5b8efa7e0 37344: restore old printable quoting, add ${(q+)...}.
The \C- form is only used inside quotedzputs().

${(q+)...} outputs a quotedzputs() representation.
2015-12-07 21:49:07 +00:00
Barton E. Schaefer
bc30d6bfca 37206: fix ${(t)param} for "typeset -H param" 2015-11-23 19:18:44 -08:00
Peter Stephenson
d814071b14 37096: Another $${(P)...} tweak.
Make a top level (P) work with nested ones, i.e. ${(P)${(P)...}...}
2015-11-12 14:28:15 +00:00
Peter Stephenson
7a951ef93e 37094: Further tweaks to parameter name references.
Safety in array test.

Make nested references work.

Add parameter tests.
2015-11-11 22:14:16 +00:00
Peter Stephenson
830d54e629 37092: make nested ${(P)name} properly refer to parameter on return 2015-11-11 18:04:20 +00:00
Peter Stephenson
e8d6041f69 37074: extend previous fix to over whitespace at end 2015-11-07 18:05:43 +00:00
Peter Stephenson
0fcc6c8fb2 37073: another SH_WORD_SPLIT problem.
In cases like x${:- y} the space was simply removed instead of
being used for splitting.
2015-11-06 17:28:02 +00:00
Barton E. Schaefer
a9add3de54 35694: fix handling of history modifiers applied across all elements of an array parameter value 2015-07-06 16:35:05 -07:00
Peter Stephenson
75cafccc0a 35343: Avoid $#name length handling for POSIX_IDENTIFIERS 2015-05-31 16:40:14 +01:00
Peter Stephenson
e88610b786 35326: $#- was misparsed as ${#-} 2015-05-29 16:06:47 +01:00
Peter Stephenson
0da0a0b9c7 35153: nested math substitution 2015-05-15 10:19:53 +01:00
Peter Stephenson
59a874f94e 35151: improved check for parameter q and b flags 2015-05-15 09:58:17 +01:00
Peter Stephenson
6269db883a 35067: Add (b) parameter flag for pattern char backslashing.
Doc tweak from Daniel in 35071.

Includes test.
2015-05-10 19:19:34 +01:00
Peter Stephenson
6fa63a0ce2 34606: fix up nested arithmetic substitution
Arithmetic within a parameter substitution is a special
case that needs fixing with the introduction of the new
Inparmath token.

Add test.
2015-02-22 21:32:08 +00:00
Peter Stephenson
2cbf9d7e65 34573: Safer failure to handle command substitution 2015-02-19 12:01:16 +00:00
Peter Stephenson
52e938bac9 34570: Another nasty command / math substituion thing.
Mark arithmetic substitutions with tokens to make sure the substitution
go knows what to do.  Before it was guessing by counting the
parentheses at the end.
2015-02-19 10:22:40 +00:00
Peter Stephenson
c6c9f5daf2 34322: bug with interface to parsestr() etc.
Was showing up in places like ${(e)...} where command substitution
could reallocate the token string, but actually there was never any
guarantee that the lexer wouldn't do that, so this was always
a bit iffy.
2015-01-18 22:38:57 +00:00
Mikael Magnusson
6c72895bc2 34105: subst: remove dead code
Found by Coverity (Issue 1255810).
2015-01-06 23:46:55 +01:00
Barton E. Schaefer
7e7449592a 34103: fix ancient double-quote handling thinko in subst_parse_str()
This doesn't seem to have mattered, but must in some obscure cases
2015-01-06 09:34:12 -08:00
Barton E. Schaefer
36ec763dbd 33976: fix overlapping strcpy() 2014-12-15 16:41:08 -08:00
Peter Stephenson
d067ebcacd 33876: etc.: Separate errors and keyboards interrupts
Combination of 12 commits from interrupt_abort branch.

Basic strategy is to introduce bits to errflag and to set and
reset them separately.

Remove interrupt status on return to main keymap.

Turn off ERRFLAG_INT for always block.

Restore bit thereafter: we probably need a new variable in order
to allow user interrupts to be reset in the always block.

Add TRY_BLOCK_INTERRUPT

This works the same as TRY_BLOCK_ERROR, but for a SIGINT, too.

Ensure propagation of SIGINT from exited job.

If received by foreground job, shell uses ERRFLAG_INT, not
ERRFLAG_ERROR, to set the new state.

Reset errflag before precmd()

Add always block in _main_completion to fix ZLS_COLORS

Ensures we get the right state of $ZLS_COLORS at the end of _main_complete
even if there's an interrupt.  However, the "right state" is a bit messy
as it depends on styles.
2014-12-11 09:41:17 +00:00
Peter Stephenson
3b5d77d819 33423: expand ${(p)...} to allow ${(ps.$param.)...} 2014-10-12 17:52:11 +01:00
Barton E. Schaefer
5a9f3ac773 33118: record original param unset state when treating empty the same as unset,
to avoid incorrect NO_UNSET errors
2014-09-06 22:15:28 -07:00
Peter Stephenson
b516dc37ac unposted: remove unused variables 2014-08-04 18:54:02 +01:00
Mikael Magnusson
b8751cb9d7 32949 (wip 32928, 32937): Add :^ syntax for zipping two arrays 2014-08-04 19:00:01 +02:00
Peter Stephenson
b79ef8caaf 32932: add hmkarray() and use to fix leak 2014-08-01 16:15:13 +01:00
Andrew Waldron
8189e12312 32552 (updated by 32560): fix segfault when using process substitution in anonymous function argument list
Also disallow process substitution in function name position.
2014-04-18 07:30:36 -07:00
Peter Stephenson
22b8fd6da9 32299: add use of underscores on arithmetic output for spacing 2014-01-23 10:32:59 +00:00
Peter Stephenson
bd919f30ae 32001: fix crash on ${:*} and ${:|} 2013-11-17 20:33:57 +00:00
Peter Stephenson
44757a653c 30993: fix parameter modifier crash with :wq on empty string 2013-01-22 16:28:58 +00:00
Peter Stephenson
eb562c9f2c 30715: use enum lextok for variables containing lexical tokens 2012-10-05 21:35:05 +00:00
Peter Stephenson
6f3ff6b653 30633: "functions -T" only traces marked function, not called functions 2012-08-21 18:03:01 +00:00
Peter Stephenson
e49e41725a unposted: add test for valid identifier to 30431 2012-04-22 20:49:39 +00:00
Peter Stephenson
cb4ff5e970 30439: ${...:*...} with nonexistent or non-array after *
should return no results
2012-04-22 18:39:53 +00:00
Peter Stephenson
5eb53bf88d 30431 with typo in _typeset fix:
add ${...:|...} and ${...:*...} operators, as documented
2012-04-22 18:10:42 +00:00
Peter Stephenson
4f142f2794 30413: (q-) parameter flag should quote null string
(q-q) etc. should be treated as errors
2012-04-16 11:26:09 +00:00
Peter Stephenson
6f93994a5a 30299: "$*" was split with SHWORDSPLIT if IFS was empty or unset 2012-02-29 09:57:40 +00:00
Bart Schaefer
15138d4fb7 30242: use PREFORK_SINGLE for ${...=...} in POSIX emulation 2012-02-20 17:50:39 +00:00
Peter Stephenson
53f893d062 30181, plus rename of PF_* flags to PREFORK_*:
Pass sh-wordsplitting instructions to paramsubst() using flags,
avoiding side effects of explicitly setting and unsetting the
SHWORDSPLIT option.
2012-02-12 20:27:48 +00:00
Peter Stephenson
ae146b0fe2 30041: fix bash-style offsets for positional parameters when scalars 2011-12-21 22:39:28 +00:00
Peter Stephenson
79dd647496 Ismail Dönmez: 29920: NO_EXEC problem with arithmetic substitution 2011-11-28 09:48:22 +00:00
Peter Stephenson
85b00bb0f7 29703: crash when failing to parse process substitutions 2011-08-17 20:26:05 +00:00
Peter Stephenson
ad29258c8c 29530: ${...?...} shouldn't cause an error with NO_EXEC option 2011-07-01 15:23:01 +00:00
Peter Stephenson
03b0edaa63 29462: fix warning 2011-06-06 09:08:21 +00:00
Peter Stephenson
22af58bf2b 29451: ${##stuff} removes stuff from the head of $# 2011-06-03 22:03:43 +00:00
Peter Stephenson
29d0aa8ef8 29351: casts needed to pass integers through stdarg 2011-05-23 16:08:47 +00:00
Mikael Magnusson
0198b8423d 29224: Support negative LEN in ${VAR:OFFSET:LEN} like bash. 2011-05-19 16:24:38 +00:00
Mikael Magnusson
6a29bc80d0 29261: Add g:: flag. 2011-05-19 16:16:28 +00:00
Mikael Magnusson
72cb7cfc6f 29307, 29308 + replies: Fix some doubled words in docs and comments. 2011-05-19 16:10:46 +00:00
Bart Schaefer
6699851bcb 29313: better sh emulation with SHWORDPLIT and empty $IFS 2011-05-18 01:49:15 +00:00
Peter Stephenson
ee52e3c349 28936: ${#$} and ${#?} also didn't work 2011-03-21 11:09:50 +00:00
Peter Stephenson
4263d2b821 28889: ${##} should return the length of $# 2011-03-11 21:05:59 +00:00
Peter Stephenson
f2dca9e155 users/15864: turn zsh_directory_name into a hook 2011-03-11 16:32:07 +00:00
Peter Stephenson
aa58d139ff Mikael: 28637: ${foo:0:} caused crash 2011-01-18 10:29:58 +00:00
Bart Schaefer
66152e8ada 28530: replace (z+opts+) flag with (Z:opts:), add reserved (_🎏). 2010-12-15 04:05:50 +00:00
Peter Stephenson
eab4f9a83c 28528: Rearrange zleparse to lexflags
Add (z+n+)
2010-12-14 09:59:04 +00:00
Peter Stephenson
0a5702457b 28510: add (z+c+) and (z+C+) parameter flags 2010-12-12 22:44:50 +00:00
Peter Stephenson
fc6c76519b 28434: make ${NAME:OFFSET} always use zero-offset 2010-11-25 10:34:32 +00:00
Peter Stephenson
e6946adf57 28425: remove null arguments and untokenize 2010-11-20 23:46:26 +00:00
Peter Stephenson
8f20b2361c 28419: Doc/Zsh/expn.yo, Src/subst.c, Test/D04parameter.ztst:
KSH_ARRAY ${*:0:1} gives $0, etc.
2010-11-18 13:57:18 +00:00
Peter Stephenson
23bdfc7fd2 28418: add ${NAME:OFFSET:LENGTH} substitution 2010-11-18 10:07:55 +00:00
Peter Stephenson
3f3d80c394 28360: NO_UNSET option should check parameters with trailing options 2010-10-22 16:32:36 +00:00
Peter Stephenson
377f2bb812 28309: fix infinite loop padding with extra wide characters 2010-10-02 19:55:30 +00:00
Peter Stephenson
64d431d98b 28025: (D) parameter flag 2010-06-11 20:08:01 +00:00
Peter Stephenson
147cedfb6f 27965, 27966: Improve ${(q)...}: newline appears as $'\n;, 2010-05-27 18:57:34 +00:00
Peter Stephenson
11440d17d1 27889: Force more use of GLOB_SUBST in parameters if ~ is used 2010-04-20 21:16:21 +00:00
Peter Stephenson
e2d855f364 27865: fix problem with glob_subst in parameter subsitution 2010-04-09 15:40:13 +00:00
Peter Stephenson
815cc9fc0d rationalise widths of non-printing characters to zero. 2010-03-27 19:04:35 +00:00
Peter Stephenson
21193d7f01 users/14905 + 14906: problems with :s in parameter expansion 2010-02-27 00:18:13 +00:00
Peter Stephenson
4a0ddedf0a unposted: a couple of typeset -g's and a comment 2010-02-08 11:49:28 +00:00
Peter Stephenson
72529e4fa6 27304: add ${(q-)..} flag 2009-06-05 11:15:48 +00:00
Peter Stephenson
feb29659f1 users/14143 plus tweak in padding code:
use default IFS if IFS is unset
2009-05-20 09:04:39 +00:00
Peter Stephenson
3e1e46e9d2 26748: c modifier to add command path 2009-03-23 12:17:32 +00:00
Peter Stephenson
7733ade831 Michael Hwang: 26731 with cosmetic changes: add "a" and "A" modifiers
26736: document the above
2009-03-15 01:17:05 +00:00
Peter Stephenson
e391f09457 26705: multibyte characters with Meta in ${(%)foo} etc. 2009-03-10 11:12:02 +00:00
Peter Stephenson
c7d8b0dfb8 26546, 26556: sticky emulation for functions defined in emulate ... -c ...
environments, plus documentation
2009-02-11 20:42:15 +00:00
Peter Stephenson
14231691e1 26061: fix clash between process subst and numeric glob
26062: additional compmatch change, missed from 26047
2008-11-18 10:07:31 +00:00
Peter Stephenson
2fbc131ca8 26055: ensure process substitution is handled before parameter and command 2008-11-17 16:11:29 +00:00
Peter Stephenson
35a8612f21 26042 with some fixes from 26043 (Mikael):
allow <(...) and >(...) to occur in the middle of strings
and =(...) to have extra text following
2008-11-13 21:18:14 +00:00
Peter Stephenson
25833cc89e 25969: two bugs with metafication plus a test for one 2008-10-30 15:34:18 +00:00
Peter Stephenson
043959b0be 25760: add (~) flag 2008-09-27 20:58:24 +00:00
Peter Stephenson
4a34c96289 25755/25756: Jörg Sommer: improved handling of module arguments
25759: fix dynamic named directory crash, static named directory consistency
2008-09-27 19:57:25 +00:00
Peter Stephenson
b2d08a2155 25744: dynamic named directories and further doshfunc() simplification 2008-09-26 09:11:27 +00:00
Peter Stephenson
1f81bdcb47 25587: fix a==(stuff) and associated stuff. 2008-09-01 20:18:46 +00:00
Peter Stephenson
bd70d684fc 25002: only ZLE should update attributes resulting from prompt expansion 2008-05-12 13:50:42 +00:00
Peter Stephenson
cc026d2339 24788: ${(m)#...} returns string print width 2008-04-03 21:10:54 +00:00
Peter Stephenson
0076d68664 24611: fix ${+array[...]} for empty range 2008-02-27 15:51:26 +00:00
Peter Stephenson
2d03aa87fb 24264: restrict effect of 24234 to parameter substitution code and document 2007-12-16 14:05:14 +00:00
Peter Stephenson
5d5d1bef6e 24234: apply typeset parameter flags consistently 2007-12-13 20:52:52 +00:00
Peter Stephenson
a232ab5624 users/12149: "@" with splitting in double quotes retains empty fields 2007-10-30 14:01:32 +00:00
Peter Stephenson
4d52b7ebe6 23670: rationalise some linked list functions 2007-06-27 13:56:10 +00:00
Peter Stephenson
abae4fe16e 23562: add KSH_ZERO_SUBSCRIPT option and leave off by default 2007-06-18 13:25:03 +00:00
Peter Stephenson
a35302ebd4 23257: buffer too short for multibyte ${(#)...} evalution 2007-04-02 11:00:35 +00:00
Bart Schaefer
3fc59a0f09 23176: apply the (X) parameter flag to the (#) flag; fix comment typo. 2007-02-25 23:41:03 +00:00
Peter Stephenson
0a532a8f7f fix metafication of ${(#)x} 2007-02-10 22:12:58 +00:00