diff options
-rw-r--r-- | ChangeLog | 43 | ||||
-rw-r--r-- | Completion/Unix/Command/_git | 7 | ||||
-rw-r--r-- | Config/version.mk | 2 | ||||
-rw-r--r-- | Etc/FAQ.yo | 2 | ||||
-rw-r--r-- | Functions/Zle/bracketed-paste-magic | 51 | ||||
-rw-r--r-- | Src/Modules/zpty.c | 3 | ||||
-rw-r--r-- | Src/Zle/zle_move.c | 4 | ||||
-rw-r--r-- | Src/Zle/zle_vi.c | 2 | ||||
-rw-r--r-- | Src/builtin.c | 11 | ||||
-rw-r--r-- | Test/C04funcdef.ztst | 13 |
10 files changed, 120 insertions, 18 deletions
@@ -1,10 +1,53 @@ +2015-08-25 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * unposted: Config/version.mk: 5.0.8-test-3. + +2015-08-24 Daniel Shahaf <d.s@daniel.shahaf.name> + + * 36277: Completion/Unix/Command/_git: _git: Updated for + git-clone 2.4.5. + +2015-08-24 Peter Stephenson <p.stephenson@samsung.com> + + * unposted: Etc/FAQ.yo: replace 5.0.9 with 5.1. + +2015-08-23 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> + + * users/20455: Src/Modules/zpty.c: do not use posix_openpt() + on OpenBSD + +2015-08-22 Barton E. Schaefer <schaefer@zsh.org> + + * 36274: Src/Zle/zle_vi.c: clear virangeflag when getvirange() + has an error (the next keystroke is not a motion/selection). + + * 36273: Src/Zle/zle_move.c: teach endofline() and endoflinehist() + about invicmdmode() cursor placement. + 2015-08-21 Peter Stephenson <p.w.stephenson@ntlworld.com> * unposted: Config/version.mk, Src/parse.c, Src/Zle/zle_misc.c: update to 5.0.8-test-2 and fix some exports. +2015-08-21 Barton E. Schaefer <schaefer@zsh.org> + + * 36266: Functions/Zle/bracketed-paste-magic: preserve emulation + and setopt context for init and finish functions, handle vi modes + + * 36256: Src/builtin.c: local options should remain in effect + for "emulate -L" even if additional option settings are applied + 2015-08-21 Peter Stephenson <p.stephenson@samsung.com> + * 36268: Test/C04funcdef.ztst: test for 36265. + + * 36265 plus FAQ: fix alias expansion after "function" + Names after the first were treated as command words so had + non-global aliases expanded. Add an FAQ note that use of the + function keyword works around other alias problems. Also + fixes problem that "function { ... }" didn't work with + IGNORE_BRACES set. + * 36264: Src/glob.c: pathbuf is apparently metafied; document this and unmetafy for system calls. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 0d705a9da..a096007d6 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -581,13 +581,14 @@ _git-clone () { # TODO: Argument to -o should be a remote name. # TODO: Argument to -b should complete branch names in the repository being - # cloned. + # cloned (see __git_references()) _arguments -w -C -S -s \ '(-l --local --no-local)'{-l,--local}'[clone locally, hardlink refs and objects if possible]' \ '(-l --local --no-local)--no-local[override --local, as if file:/// URL was given]' \ '--no-hardlinks[copy files instead of hardlinking when doing a local clone]' \ '(-s --shared)'{-s,--shared}'[share the objects with the source repository (warning: see man page)]' \ '--reference[reference repository]:repository:_directories' \ + '--dissociate[make the newly-created repository independent of the --reference repository]' \ '(-q --quiet)'{-q,--quiet}'[operate quietly]' \ '(-v --verbose)'{-v,--verbose}'[always display the progressbar]' \ '--progress[output progress even if stderr is not a terminal]' \ @@ -600,8 +601,10 @@ _git-clone () { '--template=[directory to use as a template for the object database]: :_directories' \ '*'{-c,--config}'[<key>=<value> set a configuration variable in the newly created repository]' \ '--depth[create a shallow clone, given number of revisions deep]: :__git_guard_number depth' \ - '--single-branch[clone only history leading up to the main branch or the one specified by -b]' \ + '(--no-single-branch)--single-branch[clone only history leading up to the main branch or the one specified by -b]' \ + '(--single-branch)--no-single-branch[clone history leading up to each branch]' \ '--recursive[initialize all contained submodules]' \ + '--separate-git-dir[place .git dir outside worktree]:path to .git dir:_path_files -/' \ ': :->repository' \ ': :_directories' && ret=0 diff --git a/Config/version.mk b/Config/version.mk index 99a749ebf..ab5bf4cf4 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.8-test-2 +VERSION=5.0.8-test-3 VERSION_DATE='August 21, 2015' diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo index 9b7e558a6..3188c95c6 100644 --- a/Etc/FAQ.yo +++ b/Etc/FAQ.yo @@ -1730,7 +1730,7 @@ sect(What's wrong with cut and paste on my xterm?) read; all input is read as continuation lines (this may require the fixes referred to above in order to be reliable). - As of 5.0.9, this trick is not necessary on terminal emulators that + As of 5.1, this trick is not necessary on terminal emulators that support the em(bracketed paste) feature (this includes most modern terminal emulators). See the description of tt($zle_bracketed_paste) in the tt(zshparam) manual page for details. diff --git a/Functions/Zle/bracketed-paste-magic b/Functions/Zle/bracketed-paste-magic index da106d1ac..daf5aec5a 100644 --- a/Functions/Zle/bracketed-paste-magic +++ b/Functions/Zle/bracketed-paste-magic @@ -40,7 +40,6 @@ # Also looked up in the context :bracketed-paste-magic, these styles # each are a list of function names. They are executed in widget # context but are called as functions (NOT as widgets with "zle name"). -# They also run in zsh emulation context set by bracketed-paste-magic. # As with hooks, the functions are called in order until one of them # returns a nonzero exit status. The parameter PASTED contains the # current state of the pasted text, other ZLE parameters are as usual. @@ -68,7 +67,7 @@ zstyle -m :bracketed-paste-magic active-widgets '*' || # TODO: rewrite this using match-words-by-style # backward-extend-paste() { - : emulate -LR zsh # Already set by bracketed-paste-magic + emulate -L zsh integer bep_mark=$MARK bep_region=$REGION_ACTIVE if (( REGION_ACTIVE && MARK < CURSOR )); then zle .exchange-point-and-mark @@ -99,7 +98,7 @@ backward-extend-paste() { # zstyle :bracketed-paste-magic:finish quote-style none # quote-paste() { - : emulate -LR zsh # Already set by bracketed-paste-magic + emulate -L zsh local qstyle # If there's a quoting style, be sure .bracketed-paste leaves it alone zstyle -s :bracketed-paste-magic:finish quote-style qstyle && NUMERIC=1 @@ -117,16 +116,28 @@ quote-paste() { # Now the actual function bracketed-paste-magic() { - emulate -LR zsh + # Fast exit in the vi-mode cut-buffer context + if [[ "$LASTWIDGET" = *vi-set-buffer ]]; then + zle .bracketed-paste + return + fi + + # Really necessary to go to this much effort? + local bpm_emulate="$(emulate)" bpm_opts="$-" + + emulate -L zsh local -a bpm_hooks bpm_inactive - local PASTED bpm_func bpm_active + local PASTED bpm_func bpm_active bpm_keymap=$KEYMAP # Set PASTED and run the paste-init functions zle .bracketed-paste PASTED if zstyle -a :bracketed-paste-magic paste-init bpm_hooks; then for bpm_func in $bpm_hooks; do if (( $+functions[$bpm_func] )); then - $bpm_func || break + function () { + emulate -L $bpm_emulate; set -$bpm_opts + $bpm_func || break + } fi done fi @@ -143,18 +154,37 @@ bracketed-paste-magic() { # There are active widgets. Reprocess $PASTED as keystrokes. NUMERIC=1 zle -U - $PASTED + + if [[ $bmp_keymap = vicmd ]]; then + zle -K viins + fi + + # Just in case there are active undo widgets + zle .split-undo + integer bpm_limit=$UNDO_LIMIT_NO bpm_undo=$UNDO_CHANGE_NO + UNDO_LIMIT_NO=$UNDO_CHANGE_NO + while [[ -n $PASTED ]] && zle .read-command; do PASTED=${PASTED#$KEYS} if [[ $KEYS = ${(~j:|:)${(b)bpm_inactive}} ]]; then zle .self-insert-unmeta else case $REPLY in - (${~bpm_active}) zle $REPLY;; + (${~bpm_active}) function () { + emulate -L $bpm_emulate; set -$bpm_opts + zle $REPLY + };; (*) zle .self-insert-unmeta;; esac fi done PASTED=$BUFFER + + # Reset the undo state + zle undo $bpm_undo + UNDO_LIMIT_NO=$bpm_limit + + zle -K $bpm_keymap fi # Restore state @@ -169,7 +199,10 @@ bracketed-paste-magic() { if zstyle -a :bracketed-paste-magic paste-finish bpm_hooks; then for bpm_func in $bpm_hooks; do if (( $+functions[$bpm_func] )); then - $bpm_func || break + function () { + emulate -L $bpm_emulate; set -$bpm_opts + $bpm_func || break + } fi done fi @@ -187,6 +220,6 @@ bracketed-paste-magic() { } # Handle zsh autoloading conventions -if [[ $zsh_eval_context = *loadautofunc && ! -o kshautoload ]]; then +if [[ "$zsh_eval_context" = *loadautofunc && ! -o kshautoload ]]; then bracketed-paste-magic "$@" fi diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c index 12e42b5bd..9741ee287 100644 --- a/Src/Modules/zpty.c +++ b/Src/Modules/zpty.c @@ -154,7 +154,8 @@ getptycmd(char *name) return NULL; } -#ifdef USE_DEV_PTMX +/* posix_openpt() seems to have some problem on OpenBSD */ +#if defined(USE_DEV_PTMX) && !defined(__OpenBSD__) #ifdef HAVE_SYS_STROPTS_H #include <sys/stropts.h> diff --git a/Src/Zle/zle_move.c b/Src/Zle/zle_move.c index f49df8647..155fda80d 100644 --- a/Src/Zle/zle_move.c +++ b/Src/Zle/zle_move.c @@ -344,6 +344,8 @@ endofline(char **args) zlecs = zlell; return 0; } + if ((zlecs += invicmdmode()) == zlell) + break; if (zleline[zlecs] == '\n') if (++zlecs == zlell) return 0; @@ -414,6 +416,8 @@ endoflinehist(char **args) zlecs = zlell; break; } + if ((zlecs += invicmdmode()) == zlell) + break; if (zleline[zlecs] == '\n') if (++zlecs == zlell) break; diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c index 1a11ca7d5..42dc46e7e 100644 --- a/Src/Zle/zle_vi.c +++ b/Src/Zle/zle_vi.c @@ -224,6 +224,7 @@ getvirange(int wf) ZS_memcpy(zleline, lastline, zlell = lastll); zlecs = pos; mark = mpos; + virangeflag = 0; return -1; } @@ -232,6 +233,7 @@ getvirange(int wf) if (!zlell || (zlecs == pos && (mark == -1 || mark == zlecs) && virangeflag != 2) || ret == -1) { mark = mpos; + virangeflag = 0; return -1; } virangeflag = 0; diff --git a/Src/builtin.c b/Src/builtin.c index 3d34aa74c..97022addf 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -5465,8 +5465,8 @@ bin_emulate(UNUSED(char *nam), char **argv, Options ops, UNUSED(int func)) /* with single argument set current emulation */ if (!argv[1]) { - emulate(shname, OPT_ISSET(ops,'R'), &emulation, opts); - if (OPT_ISSET(ops,'L')) + emulate(shname, opt_R, &emulation, opts); + if (opt_L) opts[LOCALOPTIONS] = opts[LOCALTRAPS] = opts[LOCALPATTERNS] = 1; clearpatterndisables(); return 0; @@ -5476,7 +5476,7 @@ bin_emulate(UNUSED(char *nam), char **argv, Options ops, UNUSED(int func)) memcpy(saveopts, opts, sizeof(opts)); memcpy(new_opts, opts, sizeof(opts)); savehackchar = keyboardhackchar; - emulate(shname, OPT_ISSET(ops,'R'), &new_emulation, new_opts); + emulate(shname, opt_R, &new_emulation, new_opts); optlist = newlinklist(); if (parseopts("emulate", &argv, new_opts, &cmd, optlist)) { ret = 1; @@ -5508,8 +5508,11 @@ bin_emulate(UNUSED(char *nam), char **argv, Options ops, UNUSED(int func)) goto restore2; } *--argv = cmd; /* on stack, never free()d, see execbuiltin() */ - } else + } else { + if (opt_L) + opts[LOCALOPTIONS] = opts[LOCALTRAPS] = opts[LOCALPATTERNS] = 1; return 0; + } save_sticky = sticky; sticky = hcalloc(sizeof(*sticky)); diff --git a/Test/C04funcdef.ztst b/Test/C04funcdef.ztst index 74f881587..0951e2cde 100644 --- a/Test/C04funcdef.ztst +++ b/Test/C04funcdef.ztst @@ -295,6 +295,19 @@ >} >This is the correct output. + unfunction command_not_found_handler # amusing but unhelpful + alias first='firstfn1 firstfn2' second='secondfn1 secondfn2' + function first second { print This is function $0; } + first + second + firstfn1 + secondfn1 +127:No alias expansion after "function" keyword +>This is function first +>This is function second +?(eval):6: command not found: firstfn1 +?(eval):7: command not found: secondfn1 + %clean rm -f file.in file.out |