From 82a3591f577a05f0941a425a631fae8058fa23ba Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Thu, 16 Jan 2014 16:05:11 +0100 Subject: 32264: vcs_info, hg: Support detecting repos using ShareExtension --- Functions/VCS_Info/Backends/VCS_INFO_detect_hg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Functions') diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_hg b/Functions/VCS_Info/Backends/VCS_INFO_detect_hg index a22c1ee0f..d7b1d0d36 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_detect_hg +++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_hg @@ -7,7 +7,7 @@ setopt localoptions NO_shwordsplit [[ $1 == '--flavours' ]] && { print -l hg-git hg-hgsubversion hg-hgsvn; return 0 } VCS_INFO_check_com ${vcs_comm[cmd]} || return 1 -vcs_comm[detect_need_file]="store data" +vcs_comm[detect_need_file]="store data sharedpath" VCS_INFO_bydir_detect '.hg' || return 1 if [[ -d ${vcs_comm[basedir]}/.hg/svn ]] ; then -- cgit v1.2.3 From 22b8fd6da931657ec930ba2625179c704de3e830 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 23 Jan 2014 10:32:59 +0000 Subject: 32299: add use of underscores on arithmetic output for spacing --- ChangeLog | 7 +++ Doc/Zsh/arith.yo | 21 +++++++ Functions/Misc/zcalc | 2 +- Src/math.c | 35 ++++++++---- Src/params.c | 151 +++++++++++++++++++++++++++++++++++++++++++++++++-- Src/subst.c | 8 +-- Test/C01arith.ztst | 16 ++++++ 7 files changed, 221 insertions(+), 19 deletions(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index ac5759e46..a232fa6d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2014-01-23 Peter Stephenson + + * 32299: Doc/Zsh/arith.yo, Functions/Misc/zcalc, Src/math.c, + Src/params.c, Src/subst.c, Test/C01arith.ztst: add + ability to use "_" at the end of a [#] arithmetic expression + to get underscores to space numeric output. + 2014-01-22 Barton E. Schaefer * unposted: Src/mem.c: reformulate 32285 to lift the fheap->sp diff --git a/Doc/Zsh/arith.yo b/Doc/Zsh/arith.yo index 2674c7817..4fff28fe2 100644 --- a/Doc/Zsh/arith.yo +++ b/Doc/Zsh/arith.yo @@ -76,6 +76,27 @@ have output base 16, while tt(x) (assuming it does not already exist) is implicitly typed by the arithmetic evaluation, where it acquires the output base 8. +The var(base) may be replaced or followed by an underscore, which may +itself be followed by a positive integer (if it is missing the value 3 +is used). This indicates that underscores should be inserted into the +output string, grouping the number for visual clarity. The following +integer specifies the number of digits to group together. For example: + +example(setopt cbases +print $(( [#16_4] 65536 ** 2 ))) + +outputs `tt(0x1_0000_0000)'. + +The feature can be used with floating +point numbers, in which case the base must be omitted; grouping +is away from the decimal point. For example, + +example(zmodload zsh/mathfunc +print $(( [#_] sqrt(1e7) ))) + +outputs `tt(3_162.277_660_168_379_5)' (the number of decimal places +shown may vary). + pindex(C_BASES, use of) pindex(OCTAL_ZEROES, use of) If the tt(C_BASES) option is set, hexadecimal numbers in the standard C diff --git a/Functions/Misc/zcalc b/Functions/Misc/zcalc index 1f3392d92..6a56d4782 100644 --- a/Functions/Misc/zcalc +++ b/Functions/Misc/zcalc @@ -196,7 +196,7 @@ while (( expression_mode )) || # special cases # Set default base if `[#16]' or `[##16]' etc. on its own. # Unset it if `[#]' or `[##]'. - if [[ $line = (#b)[[:blank:]]#('[#'(\#|)(<->|)']')[[:blank:]]#(*) ]]; then + if [[ $line = (#b)[[:blank:]]#('[#'(\#|)((<->|)(|_|_<->))']')[[:blank:]]#(*) ]]; then if [[ -z $match[4] ]]; then if [[ -z $match[3] ]]; then defbase= diff --git a/Src/math.c b/Src/math.c index 42355f885..266569827 100644 --- a/Src/math.c +++ b/Src/math.c @@ -555,6 +555,9 @@ lexconstant(void) /**/ int outputradix; +/**/ +int outputunderscore; + /**/ static int zzlex(void) @@ -713,7 +716,7 @@ zzlex(void) return EOI; case '[': { - int n; + int n, checkradix = 0; if (idigit(*ptr)) { n = zstrtol(ptr, &ptr, 10); @@ -730,9 +733,19 @@ zzlex(void) n = -1; ptr++; } - if (!idigit(*ptr)) + if (!idigit(*ptr) && *ptr != '_') goto bofs; - outputradix = n * zstrtol(ptr, &ptr, 10); + if (idigit(*ptr)) { + outputradix = n * zstrtol(ptr, &ptr, 10); + checkradix = 1; + } + if (*ptr == '_') { + ptr++; + if (idigit(*ptr)) + outputunderscore = zstrtol(ptr, &ptr, 10); + else + outputunderscore = 3; + } } else { bofs: zerr("bad output format specification"); @@ -740,11 +753,13 @@ zzlex(void) } if(*ptr != ']') goto bofs; - n = (outputradix < 0) ? -outputradix : outputradix; - if (n < 2 || n > 36) { - zerr("invalid base (must be 2 to 36 inclusive): %d", - outputradix); - return EOI; + if (checkradix) { + n = (outputradix < 0) ? -outputradix : outputradix; + if (n < 2 || n > 36) { + zerr("invalid base (must be 2 to 36 inclusive): %d", + outputradix); + return EOI; + } } ptr++; break; @@ -1337,9 +1352,9 @@ matheval(char *s) char *junk; mnumber x; int xmtok = mtok; - /* maintain outputradix across levels of evaluation */ + /* maintain outputradix and outputunderscore across levels of evaluation */ if (!mlevel) - outputradix = 0; + outputradix = outputunderscore = 0; if (!*s) { x.type = MN_INTEGER; diff --git a/Src/params.c b/Src/params.c index ad9e3470b..dc41c6c92 100644 --- a/Src/params.c +++ b/Src/params.c @@ -2416,9 +2416,10 @@ setnumvalue(Value v, mnumber val) if ((val.type & MN_INTEGER) || outputradix) { if (!(val.type & MN_INTEGER)) val.u.l = (zlong) val.u.d; - convbase(p = buf, val.u.l, outputradix); + p = convbase_underscore(buf, val.u.l, outputradix, + outputunderscore); } else - p = convfloat(val.u.d, 0, 0, NULL); + p = convfloat_underscore(val.u.d, outputunderscore); setstrvalue(v, ztrdup(p)); break; case PM_INTEGER: @@ -4555,9 +4556,14 @@ delenv(Param pm) */ } +/* + * Guts of convbase: this version can return the number of digits + * sans any base discriminator. + */ + /**/ -mod_export void -convbase(char *s, zlong v, int base) +void +convbase_ptr(char *s, zlong v, int base, int *ndigits) { int digs = 0; zulong x; @@ -4583,6 +4589,8 @@ convbase(char *s, zlong v, int base) x /= base; if (!digs) digs = 1; + if (ndigits) + *ndigits = digs; s[digs--] = '\0'; x = v; while (digs >= 0) { @@ -4593,6 +4601,64 @@ convbase(char *s, zlong v, int base) } } +/* + * Basic conversion of integer to a string given a base. + * If 0 base is 10. + * If negative no base discriminator is output. + */ + +/**/ +mod_export void +convbase(char *s, zlong v, int base) +{ + convbase_ptr(s, v, base, NULL); +} + +/* + * Add underscores to converted integer for readability with given spacing. + * s is as for convbase: at least BDIGBUFSIZE. + * If underscores were added, returned value with underscores comes from + * heap, else the returned value is s. + */ + +/**/ +char * +convbase_underscore(char *s, zlong v, int base, int underscore) +{ + char *retptr, *sptr, *dptr; + int ndigits, nunderscore, mod, len; + + convbase_ptr(s, v, base, &ndigits); + + if (underscore <= 0) + return s; + + nunderscore = (ndigits - 1) / underscore; + if (!nunderscore) + return s; + len = strlen(s); + retptr = zhalloc(len + nunderscore + 1); + mod = 0; + memcpy(retptr, s, len - ndigits); + sptr = s + len; + dptr = retptr + len + nunderscore; + /* copy the null */ + *dptr-- = *sptr--; + for (;;) { + *dptr = *sptr; + if (!--ndigits) + break; + dptr--; + sptr--; + if (++mod == underscore) { + mod = 0; + *dptr-- = '_'; + } + } + + return retptr; +} + /* * Convert a floating point value for output. * Unlike convbase(), this has its own internal storage and returns @@ -4659,6 +4725,83 @@ convfloat(double dval, int digits, int flags, FILE *fout) return ret; } +/* + * convert float to string with basic options but inserting underscores + * for readability. + */ + +/**/ +char *convfloat_underscore(double dval, int underscore) +{ + int ndigits_int = 0, ndigits_frac = 0, nunderscore, len; + char *s, *retptr, *sptr, *dptr; + + s = convfloat(dval, 0, 0, NULL); + if (underscore <= 0) + return s; + + /* + * Count the number of digits before and after the decimal point, if any. + */ + sptr = s; + if (*sptr == '-') + sptr++; + while (idigit(*sptr)) { + ndigits_int++; + sptr++; + } + if (*sptr == '.') { + sptr++; + while (idigit(*sptr)) { + ndigits_frac++; + sptr++; + } + } + + /* + * Work out how many underscores to insert --- remember we + * put them in integer and fractional parts separately. + */ + nunderscore = (ndigits_int-1) / underscore + (ndigits_frac-1) / underscore; + if (!nunderscore) + return s; + len = strlen(s); + dptr = retptr = zhalloc(len + nunderscore + 1); + + /* + * Insert underscores in integer part. + * Grouping starts from the point in both directions. + */ + sptr = s; + if (*sptr == '-') + *dptr++ = *sptr++; + while (ndigits_int) { + *dptr++ = *sptr++; + if (--ndigits_int && !(ndigits_int % underscore)) + *dptr++ = '_'; + } + if (ndigits_frac) { + /* + * Insert underscores in the fractional part. + */ + int mod = 0; + /* decimal point, we already checked */ + *dptr++ = *sptr++; + while (ndigits_frac) { + *dptr++ = *sptr++; + mod++; + if (--ndigits_frac && mod == underscore) { + *dptr++ = '_'; + mod = 0; + } + } + } + /* Copy exponent and anything else up to null */ + while ((*dptr++ = *sptr++)) + ; + return retptr; +} + /* Start a parameter scope */ /**/ diff --git a/Src/subst.c b/Src/subst.c index 1059508ef..cc5df3fba 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -3754,19 +3754,19 @@ static char * arithsubst(char *a, char **bptr, char *rest) { char *s = *bptr, *t; - char buf[BDIGBUFSIZE], *b = buf; + char buf[BDIGBUFSIZE], *b; mnumber v; singsub(&a); v = matheval(a); if ((v.type & MN_FLOAT) && !outputradix) - b = convfloat(v.u.d, 0, 0, NULL); + b = convfloat_underscore(v.u.d, outputunderscore); else { if (v.type & MN_FLOAT) v.u.l = (zlong) v.u.d; - convbase(buf, v.u.l, outputradix); + b = convbase_underscore(buf, v.u.l, outputradix, outputunderscore); } - t = *bptr = (char *) hcalloc(strlen(*bptr) + strlen(b) + + t = *bptr = (char *) hcalloc(strlen(*bptr) + strlen(b) + strlen(rest) + 1); t--; while ((*++t = *s++)); diff --git a/Test/C01arith.ztst b/Test/C01arith.ztst index 7b005c2ab..25cd8b83a 100644 --- a/Test/C01arith.ztst +++ b/Test/C01arith.ztst @@ -266,3 +266,19 @@ >48.5 >77.5 >63.5 + + underscore_integer() { + setopt cbases localoptions + print $(( [#_] 1000000 )) + print $(( [#16_] 65536 )) + print $(( [#16_4] 65536 * 32768 )) + } + underscore_integer +0:Grouping output with underscores: integers +>1_000_000 +>0x10_000 +>0x8000_0000 + + print $(( [#_] (5. ** 10) / 16. )) +0:Grouping output with underscores: floating point +>610_351.562_5 -- cgit v1.2.3 From 52f72086c93d4b5faec06665bc352246d3f4ec3f Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 28 Feb 2014 18:44:49 +0000 Subject: users 18531 plus doc etc.: new expand-absolute-path widget --- ChangeLog | 6 ++++++ Doc/Zsh/contrib.yo | 6 ++++++ Functions/Zle/.distfiles | 1 + Functions/Zle/expand-absolute-path | 19 +++++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 Functions/Zle/expand-absolute-path (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index 49dcf6b62..d4329ad4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-02-28 Peter Stephenson + + * users/18531 plus doc etc.: Doc/Zsh/contrib.yo, + Functions/Zle/.distfiles, Functions/Zle/expand-absolute-path: + new expand-absolute-path ZLE widget. + 2014-02-24 Peter Stephenson * Hong Xu: 32492: Completion/Unix/Command/_npm: fix outdated diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index bb294e5a5..11d596df8 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -1873,6 +1873,12 @@ Edit the command line using your visual editor, as in tt(ksh). example(bindkey -M vicmd v edit-command-line) ) +tindex(expand-absolute-path) +item(tt(expand-absolute-path))( +Expand the file name under the cursor to an absolute path, resolving +symbolic links. Where possible, the initial path segment is turned +into a named directory or reference to a user's home directory. +) tindex(history-beginning-search-backward-end) tindex(history-beginning-search-forward-end) item(tt(history-search-end))( diff --git a/Functions/Zle/.distfiles b/Functions/Zle/.distfiles index 256044fa5..5b301b62b 100644 --- a/Functions/Zle/.distfiles +++ b/Functions/Zle/.distfiles @@ -10,6 +10,7 @@ delete-whole-word-match down-case-word-match down-line-or-beginning-search edit-command-line +expand-absolute-path forward-word-match history-beginning-search-menu history-pattern-search diff --git a/Functions/Zle/expand-absolute-path b/Functions/Zle/expand-absolute-path new file mode 100644 index 000000000..b85757600 --- /dev/null +++ b/Functions/Zle/expand-absolute-path @@ -0,0 +1,19 @@ +# expand-absolute-path +# This is a ZLE widget to expand the absolute path to a file, +# using directory naming to shorten the path where possible. + +emulate -L zsh +setopt extendedglob cbases + +autoload -Uz modify-current-argument + +if (( ! ${+functions[glob-expand-absolute-path]} )); then + glob-expand-absolute-path() { + local -a files + files=(${~1}(N:A)) + (( ${#files} )) || return + REPLY=${(D)files[1]} + } +fi + +modify-current-argument glob-expand-absolute-path -- cgit v1.2.3 From 965d7305e57b9b1a009af71368fcbf6da4e756a8 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sat, 1 Mar 2014 21:27:47 +0000 Subject: 32453: fix zcalc default base handling --- ChangeLog | 2 ++ Functions/Misc/zcalc | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index 7344e7a16..1cd1431d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2014-03-01 Peter Stephenson + * 32453: Functions/Misc/zcalc: fix default base handling. + * Manuel Presnitz: 32412 modified c.f. 32415: Completion/Zsh/Type/_globquals, Doc/Zsh/expn.yo, Src/glob.c, Src/zsh.h: gigabyte and terabyte units for glob qualifiers. diff --git a/Functions/Misc/zcalc b/Functions/Misc/zcalc index 6a56d4782..b79644687 100644 --- a/Functions/Misc/zcalc +++ b/Functions/Misc/zcalc @@ -197,7 +197,7 @@ while (( expression_mode )) || # Set default base if `[#16]' or `[##16]' etc. on its own. # Unset it if `[#]' or `[##]'. if [[ $line = (#b)[[:blank:]]#('[#'(\#|)((<->|)(|_|_<->))']')[[:blank:]]#(*) ]]; then - if [[ -z $match[4] ]]; then + if [[ -z $match[6] ]]; then if [[ -z $match[3] ]]; then defbase= else -- cgit v1.2.3 From eb4c70d0b7856a8ddfeb4ea2d3d83991f5cb82d3 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 28 Mar 2014 11:00:35 +0000 Subject: 32528: vcs_info: Add check-for-staged-changes --- ChangeLog | 6 ++++++ Completion/Zsh/Command/_zstyle | 2 ++ Doc/Zsh/contrib.yo | 13 +++++++++++++ Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 21 ++++++++++++++++----- Misc/vcs_info-examples | 4 ++++ 5 files changed, 41 insertions(+), 5 deletions(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index 7fd302ef9..0e11ebc1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-04-05 Daniel Shahaf + + * 32528: Completion/Zsh/Command/_zstyle, Doc/Zsh/contrib.yo, + Functions/VCS_Info/Backends/VCS_INFO_get_data_git, + Misc/vcs_info-examples: vcs_info: Add check-for-staged-changes + 2014-03-28 Peter Stephenson * Danek Duvall: 32505: Completion/Unix/Command/_pgrep: improved diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle index 708c0fddf..eb27117b2 100644 --- a/Completion/Zsh/Command/_zstyle +++ b/Completion/Zsh/Command/_zstyle @@ -182,6 +182,8 @@ styles=( disable v:vcs disable-patterns v: check-for-changes v:bool + check-for-staged-changes + v:bool stagedstr v: unstagedstr v: command v:_command_names diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index c44647163..c862fa484 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -837,6 +837,18 @@ Note, the actions taken if this style is enabled are potentially expensive (read: they may be slow, depending on how big the current repository is). Therefore, it is disabled by default. ) +kindex(check-for-staged-changes) +item(tt(check-for-staged-changes))( +This style is like tt(check-for-changes), but it never checks the worktree +files, only the metadata in the tt(.${vcs}) dir. Therefore, +this style initializes only the tt(%c) escape (with tt(stagedstr)) but +not the tt(%u) escape. This style is faster than tt(check-for-changes). + +In the tt(git) backend, this style checks for changes in the index. +Other backends do not currently implement this style. + +This style is disabled by default. +) kindex(stagedstr) item(tt(stagedstr))( This string will be used in the tt(%c) escape if there are staged changes in @@ -941,6 +953,7 @@ sitem(tt(enable))(ALL) sitem(tt(disable))((empty list)) sitem(tt(disable-patterns))((empty list)) sitem(tt(check-for-changes))(false) +sitem(tt(check-for-staged-changes))(false) sitem(tt(stagedstr))((string: "S")) sitem(tt(unstagedstr))((string: "U")) sitem(tt(command))((empty string)) diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index e6791cb7a..6512851cc 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -5,6 +5,7 @@ setopt localoptions extendedglob NO_shwordsplit local gitdir gitbase gitbranch gitaction gitunstaged gitstaged gitsha1 local stgitpatch stgitunapplied +local -i querystaged queryunstaged local -A hook_com VCS_INFO_git_getaction () { @@ -120,14 +121,24 @@ if [[ -z ${gitdir} ]] || [[ -z ${gitbranch} ]] ; then return 1 fi -if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "check-for-changes" && \ +if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "check-for-changes" ; then + querystaged=1 + queryunstaged=1 +elif zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "check-for-staged-changes" ; then + querystaged=1 +fi +if (( querystaged || queryunstaged )) && \ [[ "$(${vcs_comm[cmd]} rev-parse --is-inside-git-dir 2> /dev/null)" != 'true' ]] && \ ${vcs_comm[cmd]} rev-parse --quiet --verify HEAD &> /dev/null ; then # Default: off - these are potentially expensive on big repositories - ${vcs_comm[cmd]} diff --no-ext-diff --ignore-submodules --quiet --exit-code || - gitunstaged=1 - ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules HEAD 2> /dev/null - (( $? && $? != 128 )) && gitstaged=1 + if (( queryunstaged )) ; then + ${vcs_comm[cmd]} diff --no-ext-diff --ignore-submodules --quiet --exit-code || + gitunstaged=1 + fi + if (( querystaged )) ; then + ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules HEAD 2> /dev/null + (( $? && $? != 128 )) && gitstaged=1 + fi fi VCS_INFO_adjust diff --git a/Misc/vcs_info-examples b/Misc/vcs_info-examples index b07bfc67c..5d8ff187e 100644 --- a/Misc/vcs_info-examples +++ b/Misc/vcs_info-examples @@ -266,6 +266,10 @@ autoload -Uz vcs_info zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:*' get-revision true +# Alternatively, the following would set only %c, but is faster: +#zstyle ':vcs_info:*' check-for-changes false +#zstyle ':vcs_info:*' check-for-staged-changes true + # Default to running vcs_info. If possible we prevent running it later for # speed reasons. If set to a non empty value vcs_info is run. -- cgit v1.2.3 From 47c440aa2a141b1af60c2df192ff257b902dd177 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 7 Apr 2014 09:58:30 +0100 Subject: 32527: zcalc-auto-insert key binding for use in zcalc --- ChangeLog | 6 ++++++ Doc/Zsh/contrib.yo | 19 +++++++++++++++++++ Functions/Misc/zcalc | 3 +++ Functions/Zle/zcalc-auto-insert | 8 ++++++++ 4 files changed, 36 insertions(+) create mode 100644 Functions/Zle/zcalc-auto-insert (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index 0488ea158..f91b414f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-04-07 Peter Stephenson + + * 32527: Doc/Zsh/contrib.yo, Functions/Misc/zcalc, + Functions/Zle/zcalc-auto-insert: zcalc-auto-insert widget + for key binding in zcalc. + 2014-04-06 Barton E. Schaefer * unposted: Doc/Zsh/options.yo: fix typo in option cross-reference diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index a4000fd12..9f59f231d 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -2473,6 +2473,25 @@ The style tt(whence) is available in the context tt(:zle:$WIDGET); this may be set to an array to give the command and options that will be used to investigate the command word found. The default is tt(whence -c). ) +tindex(zcalc-auto-insert) +item(tt(zcalc-auto-insert))( +This function is useful together with the tt(zcalc) function described in +ifzman(the section Mathematical Functions)\ +ifnzman(noderef(Mathematical Functions)). +It should be bound to a key representing a binary operator such +as `tt(PLUS())', `tt(-)', `tt(*)' or `tt(/)'. When running in zcalc, +if the key occurs at the start of the line or immediately following +an open parenthesis, the text tt("ans ") is inserted before the +representation of the key itself. This allows easy use of the +answer from the previous calculation in the current line. The +text to be inserted before the symbol typed can be modified by setting +the variable tt(ZCALC_AUTO_INSERT_PREFIX). + +Hence, for example, typing `tt(PLUS()12)' followed by return adds 12 +to the previous result. + +When not in zcalc, the key simply inserts the symbol itself. +) enditem() subsect(Utility Functions) diff --git a/Functions/Misc/zcalc b/Functions/Misc/zcalc index b79644687..63f67adb0 100644 --- a/Functions/Misc/zcalc +++ b/Functions/Misc/zcalc @@ -96,6 +96,9 @@ emulate -L zsh setopt extendedglob +# For testing in ZLE functions. +local ZCALC_ACTIVE=1 + # TODO: make local variables that shouldn't be visible in expressions # begin with _. local line ans base defbase forms match mbegin mend psvar optlist opt arg diff --git a/Functions/Zle/zcalc-auto-insert b/Functions/Zle/zcalc-auto-insert new file mode 100644 index 000000000..c9a5c8867 --- /dev/null +++ b/Functions/Zle/zcalc-auto-insert @@ -0,0 +1,8 @@ +# Bind to a binary operator keystroke for use with zcalc + +if [[ -n $ZCALC_ACTIVE ]]; then + if [[ $CURSOR -eq 0 || $LBUFFER[-1] = "(" ]]; then + LBUFFER+=${ZCALC_AUTO_INSERT_PREFIX:-"ans "} + fi +fi +zle .self-insert -- cgit v1.2.3 From 08d4a6136e5c289d1be6d6290568866c2d59ef53 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 7 Apr 2014 09:59:35 +0100 Subject: addition to 32527: also update .distfiles --- Functions/Zle/.distfiles | 1 + 1 file changed, 1 insertion(+) (limited to 'Functions') diff --git a/Functions/Zle/.distfiles b/Functions/Zle/.distfiles index 5b301b62b..b43476032 100644 --- a/Functions/Zle/.distfiles +++ b/Functions/Zle/.distfiles @@ -44,5 +44,6 @@ up-case-word-match up-line-or-beginning-search url-quote-magic which-command +zcalc-auto-insert zed-set-file-name ' -- cgit v1.2.3 From 6a201af3416ae177a66486e9af500c25a117c91e Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Tue, 8 Apr 2014 21:07:28 +0000 Subject: 32597: vcs_info git: Describe detached heads symbolically. This makes %b expand to a refname rather than a sha1 when HEAD is detached but happens to match some ref (branch, tag, etc). The resulting output will typically contain a slash (e.g., "tags/v1.0.2", "heads/mybranch"), which helps distinguish it from the output in the "HEAD is a symbolic ref" case. --- ChangeLog | 5 +++++ Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index 377ae2207..b040b205d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-05-06 Daniel Shahaf + + * 32597: Functions/VCS_Info/Backends/VCS_INFO_get_data_git: + vcs_info git: Describe detached heads symbolically. + 2014-04-29 Peter Stephenson * Tomoki Sekiyama: 32592: add CORRECT_IGNORE_FILE variable. diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 6512851cc..a48dc390d 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -97,7 +97,7 @@ VCS_INFO_git_getbranch () { gitbranch="$(${(z)gitsymref} 2> /dev/null)" if [[ $? -ne 0 ]] ; then - gitbranch="refs/tags/$(${vcs_comm[cmd]} describe --exact-match HEAD 2>/dev/null)" + gitbranch="refs/tags/$(${vcs_comm[cmd]} describe --all --exact-match HEAD 2>/dev/null)" if [[ $? -ne 0 ]] ; then gitbranch="${${"$(< $gitdir/HEAD)"}[1,7]}..." -- cgit v1.2.3 From bb271217fe16bc260a4a7ffa29b674c2a7abbc8e Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 25 May 2014 21:53:35 +0000 Subject: 32619: vcs_info svn: Use the revision of cwd Previously, the value of the wc root would be used. In Subversion, it makes more sense to use the revision of cwd, since all commands (e.g., 'svn ci', 'svnversion') operate only on cwd and below, not on wcroot and below. --- ChangeLog | 5 +++++ Functions/VCS_Info/Backends/VCS_INFO_get_data_svn | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index 22f6b3cf8..33b693247 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-05-29 Daniel Shahaf + + * 32619: Functions/VCS_Info/Backends/VCS_INFO_get_data_svn: + vcs_info svn: Use the revision of cwd + 2014-05-18 Peter Stephenson * Jun T: 32616: Src/Builtins/rlimits.c: unnecessary printf diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn index 41cc3e783..ae3c49959 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn @@ -7,7 +7,7 @@ setopt localoptions noksharrays extendedglob NO_shwordsplit local svnbase svnbranch a b rrn local -i rc -local -A svninfo parentinfo +local -A svninfo parentinfo cwdinfo local -xA hook_com svnbase="."; @@ -28,6 +28,8 @@ done #rc=${pipestatus[1]} #(( rc != 0 )) && return 1 +cwdinfo=(${(kv)svninfo}) + while [[ -d "${svnbase}/../.svn" ]]; do parentinfo=() ${vcs_comm[cmd]} info --non-interactive "${svnbase}/.." | while IFS=: read a b; do parentinfo[${a// /_}]="${b## #}"; done @@ -40,12 +42,12 @@ svnbase="$(VCS_INFO_realpath ${svnbase})" rrn=${svnbase:t} zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat svnbranch || svnbranch="%b:%r" -hook_com=( branch "${svninfo[URL]##*/}" revision "${svninfo[Revision]}" ) +hook_com=( branch "${svninfo[URL]##*/}" revision "${cwdinfo[Revision]}" ) if VCS_INFO_hook 'set-branch-format' "${svnbranch}"; then zformat -f svnbranch "${svnbranch}" "b:${hook_com[branch]}" "r:${hook_com[revision]}" else svnbranch=${hook_com[branch-replace]} fi hook_com=() -VCS_INFO_formats '' "${svnbranch}" "${svnbase}" '' '' "${svninfo[Revision]}" '' +VCS_INFO_formats '' "${svnbranch}" "${svnbase}" '' '' "${cwdinfo[Revision]}" '' return 0 -- cgit v1.2.3 From 55d5feed30938da181fbbbef34ad0ae0699714f2 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 25 May 2014 21:56:26 +0000 Subject: 32621: vcs_info svn: 'Fix set-branch-format' when in subdirs The previous code would fail to detect the wcroot with Subversion 1.7+ when cwd is at least two levels below the root (i.e., ../../.svn exists and ../.svn doesn't), and would then pass to the hook the revision and basename of cwd rather than of the wcroot. --- ChangeLog | 3 +++ Functions/VCS_Info/Backends/VCS_INFO_get_data_svn | 22 +++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index 33b693247..3dce05e0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ * 32619: Functions/VCS_Info/Backends/VCS_INFO_get_data_svn: vcs_info svn: Use the revision of cwd + * 32621: Functions/VCS_Info/Backends/VCS_INFO_get_data_svn: + vcs_info svn: 'Fix set-branch-format' when in subdirs + 2014-05-18 Peter Stephenson * Jun T: 32616: Src/Builtins/rlimits.c: unnecessary printf diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn index ae3c49959..e56afee02 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn @@ -30,13 +30,21 @@ done cwdinfo=(${(kv)svninfo}) -while [[ -d "${svnbase}/../.svn" ]]; do - parentinfo=() - ${vcs_comm[cmd]} info --non-interactive "${svnbase}/.." | while IFS=: read a b; do parentinfo[${a// /_}]="${b## #}"; done - [[ ${parentinfo[Repository_UUID]} != ${svninfo[Repository_UUID]} ]] && break - svninfo=(${(kv)parentinfo}) - svnbase="${svnbase}/.." -done +# Set svnbase to the wcroot path and svninfo to its `svn info`. +if (( ${+svninfo[Working_Copy_Root_Path]} )); then + # svn 1.7+ + svnbase=${svninfo[Working_Copy_Root_Path]} + ${vcs_comm[cmd]} info --non-interactive -- "${svnbase}" | while IFS=: read a b; do svninfo[${a// /_}]="${b## #}"; done +else + # svn 1.0-1.6 + while [[ -d "${svnbase}/../.svn" ]]; do + parentinfo=() + ${vcs_comm[cmd]} info --non-interactive -- "${svnbase}/.." | while IFS=: read a b; do parentinfo[${a// /_}]="${b## #}"; done + [[ ${parentinfo[Repository_UUID]} != ${svninfo[Repository_UUID]} ]] && break + svninfo=(${(kv)parentinfo}) + svnbase="${svnbase}/.." + done +fi svnbase="$(VCS_INFO_realpath ${svnbase})" -- cgit v1.2.3 From b85b09b78b52b07cf0b83ae7892676327828a37f Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 30 May 2014 23:50:55 +0000 Subject: 32662: vcs_info git: Fix stagedstr for empty repos In empty repositories, HEAD is an unresolvable symbolic ref. Start computing stagedstr/unstagedstr in that case; for the former, use a different method than the non-empty-repository case. --- ChangeLog | 5 +++++ Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 14 ++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index cf25fda8f..688e2727a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-06-02 Daniel Shahaf + + * 32662: Functions/VCS_Info/Backends/VCS_INFO_get_data_git: + vcs_info git: Fix stagedstr for empty repos + 2014-06-01 Barton E. Schaefer * 32653: Completion/Unix/Command/_php: complete files with the diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index a48dc390d..76ab92f33 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -128,16 +128,22 @@ elif zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "check-for-staged-change querystaged=1 fi if (( querystaged || queryunstaged )) && \ - [[ "$(${vcs_comm[cmd]} rev-parse --is-inside-git-dir 2> /dev/null)" != 'true' ]] && \ - ${vcs_comm[cmd]} rev-parse --quiet --verify HEAD &> /dev/null ; then + [[ "$(${vcs_comm[cmd]} rev-parse --is-inside-work-tree 2> /dev/null)" == 'true' ]] ; then # Default: off - these are potentially expensive on big repositories if (( queryunstaged )) ; then ${vcs_comm[cmd]} diff --no-ext-diff --ignore-submodules --quiet --exit-code || gitunstaged=1 fi if (( querystaged )) ; then - ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules HEAD 2> /dev/null - (( $? && $? != 128 )) && gitstaged=1 + if ${vcs_comm[cmd]} rev-parse --quiet --verify HEAD &> /dev/null ; then + ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules HEAD 2> /dev/null + (( $? && $? != 128 )) && gitstaged=1 + else + # empty repository (no commits yet) + # 4b825dc642cb6eb9a060e54bf8d69288fbee4904 is the git empty tree. + ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules 4b825dc642cb6eb9a060e54bf8d69288fbee4904 2>/dev/null + (( $? && $? != 128 )) && gitstaged=1 + fi fi fi -- cgit v1.2.3 From 4e54648add79f7cb0c0fe81e46f49817d4555f2a Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 17 Jul 2014 09:45:46 +0100 Subject: 32866: new replace-argument ZLE function. Also a couple of read-from-minibuffer fixes: don't pass numeric argument to recursive edit, and hide the minibuffer edit from the undo history. --- ChangeLog | 9 ++++++++ Doc/Zsh/contrib.yo | 25 +++++++++++++++++++++ Functions/Zle/read-from-minibuffer | 9 ++++++++ Functions/Zle/replace-argument | 46 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 89 insertions(+) create mode 100644 Functions/Zle/replace-argument (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index a2f0e20cd..33bb0fd87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2014-07-17 Peter Stephenson + + * 32866 (plus extra undo fix in read-from-minibuffer): + Doc/Zsh/contrib.yo, Functions/Zle/read-from-minibuffer, + Functions/Zle/replace-argument: new replace-argument function; + fixes in read-from-minibuffer not to pass through numeric + argument to recursive edit and to hide minibuffer edit from + undo history. + 2014-07-08 Peter Stephenson * Dominic Hopf: 32837: Config/defs.mk.in: improve handling of diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index 2fcfbbdc7..4ee404c1b 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -2328,6 +2328,31 @@ The name is a slight misnomer, as in fact the shell's own minibuffer is not used. Hence it is still possible to call tt(executed-named-cmd) and similar functions while reading a value. ) +tindex(replace-argument) +tindex(replace-argument-edit) +item(tt(replace-argument), tt(replace-argument-edit)) +( +The function tt(replace-argument) can be used to replace a command +line argument in the current command line or, if the current command +line is empty, in the last command line executed (the new command line +is not executed). Arguments are as delimited by standard shell syntax, + +If a numeric argument is given, that specifies the argument to be +replaced. 0 means the command name, as in history expansion. + +If no numeric argument is given, the current argument is replaced; +this is the last argument if the previous history line is being used. + +The function prompts for a replacement argument. + +If the widget contains the string tt(edit), for example is defined as + +example(zle -N replace-argument-edit replace-argument) + +then the function presents the current value of the argument for +editing, otherwise the editing buffer for the replacement is +initially empty. +) tindex(replace-string) tindex(replace-string-again) tindex(replace-pattern) diff --git a/Functions/Zle/read-from-minibuffer b/Functions/Zle/read-from-minibuffer index 57e926884..8fec1105e 100644 --- a/Functions/Zle/read-from-minibuffer +++ b/Functions/Zle/read-from-minibuffer @@ -20,7 +20,9 @@ done (( OPTIND > 1 )) && shift $(( OPTIND - 1 )) local readprompt="$1" lbuf_init="$2" rbuf_init="$3" +integer changeno=$UNDO_CHANGE_NO +{ # Use anonymous function to make sure special values get restored, # even if this function is called as a widget. # local +h ensures special parameters stay special. @@ -39,10 +41,17 @@ local readprompt="$1" lbuf_init="$2" rbuf_init="$3" read -k $keys stat=$? else + local NUMERIC + unset NUMERIC zle recursive-edit -K main stat=$? (( stat )) || REPLY=$BUFFER fi } +} always { + # This removes the edits relating to the read from the undo history. + # These aren't useful once we get back to the main editing buffer. + zle undo $changeno +} return $stat diff --git a/Functions/Zle/replace-argument b/Functions/Zle/replace-argument new file mode 100644 index 000000000..b43fc39bb --- /dev/null +++ b/Functions/Zle/replace-argument @@ -0,0 +1,46 @@ +# Replace an argument to a command, delimited by normal shell syntax. +# Prompts for the replacement. +# With no numeric argument, replace the current argument. +# With a numeric argument, replace that argument: 0 = command word, +# as in history expansion. +# If editing buffer is empty, use previous history line. + +autoload -Uz split-shell-arguments read-from-minibuffer + +if (( ${#BUFFER} == 0 )); then + (( HISTNO-- )) + CURSOR=${#BUFFER} +fi + +local widget=$WIDGET +integer numeric cursor=CURSOR +if (( ${+NUMERIC} )); then + numeric=$NUMERIC +else + numeric=-1 +fi +local reply REPLY REPLY2 +integer index +split-shell-arguments + +if (( numeric >= 0 )); then + index=$(( 2 + 2*numeric )) +else + index=$((REPLY & ~1 )) +fi + +local edit +if [[ $widget = *edit* ]]; then + edit=$reply[$index] +fi +read-from-minibuffer "Replace $reply[$index] with: " $edit || return 1 + +integer diff=$(( ${#REPLY} - ${#reply[$index]} )) +reply[$index]=$REPLY + +BUFFER=${(j..)reply} +if (( cursor > REPLY2 )); then + (( CURSOR = cursor + diff )) +else + (( CURSOR = REPLY2 )) +fi -- cgit v1.2.3 From 6076c474f2427ec9a75cecab1fc95f7cd9f066f6 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 24 Jul 2014 10:49:50 +0100 Subject: unposted: replace-argument can take negative prefix to count from end --- ChangeLog | 6 ++++++ Doc/Zsh/contrib.yo | 1 + Functions/Zle/replace-argument | 16 +++++++++------- 3 files changed, 16 insertions(+), 7 deletions(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index e9deb6e55..563708769 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-07-24 Peter Stephenson + + * unposted: Functions/Zle/replace-argument, Doc/Zsh/contrib.yo: + allow negative numeric prefix to count backwards from last + argument. + 2014-07-23 Peter Stephenson * Jai Keerthan: users/18981: Completion/Unix/Command/_tmux: diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index 4ee404c1b..1c1a66a3b 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -2339,6 +2339,7 @@ is not executed). Arguments are as delimited by standard shell syntax, If a numeric argument is given, that specifies the argument to be replaced. 0 means the command name, as in history expansion. +A negative numeric argument counts backward from the last word. If no numeric argument is given, the current argument is replaced; this is the last argument if the previous history line is being used. diff --git a/Functions/Zle/replace-argument b/Functions/Zle/replace-argument index b43fc39bb..0ef3de7b5 100644 --- a/Functions/Zle/replace-argument +++ b/Functions/Zle/replace-argument @@ -12,21 +12,23 @@ if (( ${#BUFFER} == 0 )); then CURSOR=${#BUFFER} fi -local widget=$WIDGET -integer numeric cursor=CURSOR +local widget=$WIDGET numeric +integer cursor=CURSOR if (( ${+NUMERIC} )); then numeric=$NUMERIC -else - numeric=-1 fi local reply REPLY REPLY2 integer index split-shell-arguments -if (( numeric >= 0 )); then - index=$(( 2 + 2*numeric )) +if [[ -n $numeric ]]; then + if (( numeric < 0 )); then + (( index = ${#reply} - 1 + 2*(numeric+1) )) + else + (( index = 2 + 2*numeric )) + fi else - index=$((REPLY & ~1 )) + (( index = REPLY & ~1 )) fi local edit -- cgit v1.2.3 From 15db636380a6010c8486b3a7dc27188c96beff9c Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 30 Jul 2014 12:26:03 +0100 Subject: %P at start of TCP function system prompt causes %-style prompt subst --- ChangeLog | 10 +++++++--- Doc/Zsh/tcpsys.yo | 4 ++++ Functions/TCP/tcp_output | 3 +++ 3 files changed, 14 insertions(+), 3 deletions(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index f71458516..f415e4803 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,12 @@ 2014-07-30 Peter Stephenson - * 32918: Doc/Zsh/prompt.yo, Functions/TCP/tcp_output, - Src/builtin.c,Src/prompt.c, Src/utils.c, Src/watch.c: add - ability to display times with fractions of a second in prompts. + * 32919: Doc/Zsh/tcpsys.yo Functions/TCP/tcp_output: %P + at start of prompt in TCP function system causes standard + %-style substitution. + + * 32918: Doc/Zsh/prompt.yo, Src/builtin.c,Src/prompt.c, + Src/utils.c, Src/watch.c: add ability to display times with + fractions of a second in prompts. 2014-07-28 Barton E. Schaefer diff --git a/Doc/Zsh/tcpsys.yo b/Doc/Zsh/tcpsys.yo index 599335bc9..1e26054ce 100644 --- a/Doc/Zsh/tcpsys.yo +++ b/Doc/Zsh/tcpsys.yo @@ -666,6 +666,10 @@ expression `tt(%c)' expands to 1 if the session being read is the current session, else 0; this is most useful in ternary expressions such as `tt(%LPAR()c.-.PLUS()RPAR())' which outputs `tt(PLUS())' if the session is the current one, else `tt(-)'. + +If the prompt starts with tt(%P), this is stripped and the complete +result of the previous stage is passed through standard prompt tt(%)-style +formatting before being output. ) vindex(TCP_READ_DEBUG) item(tt(TCP_READ_DEBUG))( diff --git a/Functions/TCP/tcp_output b/Functions/TCP/tcp_output index 781c46c33..22e818e17 100644 --- a/Functions/TCP/tcp_output +++ b/Functions/TCP/tcp_output @@ -35,6 +35,9 @@ if [[ -n $tprompt ]]; then cursess="c:0" fi zformat -f REPLY $tprompt "s:$sess" "f:$read_fd" $cursess + if [[ $REPLY = %P* ]]; then + REPLY=${(%)${REPLY##%P}} + fi # We will pass this back up. REPLY="$REPLY$*" else -- cgit v1.2.3 From f8ae47f29b766dc0330b19d7fdb35859d6aab930 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 10 Aug 2014 17:49:55 +0100 Subject: unposted: updates for 5.0.5-dev-1 and subsequent 5.0.6 release --- ChangeLog | 8 ++++++++ Completion/Base/Completer/.distfiles | 1 + Completion/Linux/Command/.distfiles | 1 + Completion/Unix/Command/.distfiles | 2 ++ Config/version.mk | 4 ++-- Etc/.distfiles | 4 ++++ Etc/FAQ.yo | 2 +- Functions/Zle/.distfiles | 1 + NEWS | 6 ++++++ README | 6 ++---- 10 files changed, 28 insertions(+), 7 deletions(-) (limited to 'Functions') diff --git a/ChangeLog b/ChangeLog index 4f50392df..c772b0670 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-08-10 Peter Stephenson + + * unposted: Completion/Base/Completer/.distfiles, + Completion/Linux/Command/.distfiles, + Completion/Unix/Command/.distfiles, Config/version.mk, + Etc/.distfiles, Etc/FAQ.yo, Functions/Zle/.distfiles, NEWS, + README: updates for 5.0.5-dev-1 and 5.0.6 release. + 2014-08-10 Axel Beckert * unposted: Doc/Zsh/expn.yo: Fix typo. diff --git a/Completion/Base/Completer/.distfiles b/Completion/Base/Completer/.distfiles index 3030142de..804c57990 100644 --- a/Completion/Base/Completer/.distfiles +++ b/Completion/Base/Completer/.distfiles @@ -6,6 +6,7 @@ _complete _correct _expand _expand_alias +_extensions _history _ignored _list diff --git a/Completion/Linux/Command/.distfiles b/Completion/Linux/Command/.distfiles index f7861b3a2..7ae5cf91e 100644 --- a/Completion/Linux/Command/.distfiles +++ b/Completion/Linux/Command/.distfiles @@ -26,6 +26,7 @@ _schedtool _ss _sshfs _strace +_sysstat _tpb _tpconfig _tune2fs diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index 9a1cf0acd..fe810e1c4 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -16,6 +16,7 @@ _baz _bison _bittorrent _bogofilter +_bpython _bzip2 _bzr _cal @@ -137,6 +138,7 @@ _mh _mkdir _module _monotone +_moosic _mosh _mount _mpc diff --git a/Config/version.mk b/Config/version.mk index 9c17c930c..f369c18e6 100644 --- a/Config/version.mk +++ b/Config/version.mk @@ -27,5 +27,5 @@ # This must also serve as a shell script, so do not add spaces around the # `=' signs. -VERSION=5.0.5-dev-0 -VERSION_DATE='January 6, 2014' +VERSION=5.0.5-dev-1 +VERSION_DATE='August 10, 2014' diff --git a/Etc/.distfiles b/Etc/.distfiles index 2f9d7cd12..8c1218e72 100644 --- a/Etc/.distfiles +++ b/Etc/.distfiles @@ -26,3 +26,7 @@ relnote_4.3.12.txt relnote_5.0.0.txt zsh-development-guide ' + +DISTFILES_DOC=' +FAQ*.html +' diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo index 82053d003..ed703c68b 100644 --- a/Etc/FAQ.yo +++ b/Etc/FAQ.yo @@ -302,7 +302,7 @@ sect(On what machines will it run?) sect(What's the latest version?) - Zsh 5.0.5 is the latest production version. For details of all the + Zsh 5.0.6 is the latest production version. For details of all the changes, see the NEWS file in the source distribution. A beta of the next version is sometimes available. Development of zsh is diff --git a/Functions/Zle/.distfiles b/Functions/Zle/.distfiles index b43476032..90a07690b 100644 --- a/Functions/Zle/.distfiles +++ b/Functions/Zle/.distfiles @@ -32,6 +32,7 @@ narrow-to-region-invisible predict-on quote-and-complete-word read-from-minibuffer +replace-argument replace-string replace-string-again select-word-style diff --git a/NEWS b/NEWS index 98dc0437a..c5e226a24 100644 --- a/NEWS +++ b/NEWS @@ -72,6 +72,12 @@ values of N still count the space used since the start of the prompt). In PS1 and PROMPT, this counts to the right margin, whereas in RPS1 and RPROMPT, it counts to the left margin (not to the opposite prompt). +Another new prompt feature is the %. escape within time strings, for +example %D{%H:%M:%S.%.}. It provides zero-padded decimal fractions of +second; by default milliseconds are shown, but the number of digits may +be indicated from 1 to 6, e.g. "%6.". (Note this is part of the +extensions to strftime() formats rather of basic prompt escapes.) + Changes between 4.2 and 5.0.0 ----------------------------- diff --git a/README b/README index 09e96e8f9..198e4c8ff 100644 --- a/README +++ b/README @@ -5,10 +5,8 @@ THE Z SHELL (ZSH) Version ------- -This is version 5.0.5 of the shell. This is a stable release. -There are minor new features as well as bug fixes since 5.0.2. -5.0.3 and 5.0.4 were short-lived releases with most of the features of -5.0.5 that were replaced owing to significant bugs. +This is version 5.0.6 of the shell. This is a stable release. +There are minor new features as well as bug fixes since 5.0.5. Installing Zsh -------------- -- cgit v1.2.3