From 881474edcb223ac22a08d81a824809c33ca3a9c9 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 21 Aug 2015 21:33:37 +0100 Subject: unposted: fix up for 5.0.8-test-2 --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 5c2cdf8f5..3db846c4b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-08-21 Peter Stephenson + + * 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 Peter Stephenson * 36264: Src/glob.c: pathbuf is apparently metafied; document -- cgit 1.4.1 From 8abe1496fb3577c11eb98bd57fa6162763e1b7f5 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Fri, 21 Aug 2015 10:55:43 -0700 Subject: 36256: local options should remain in effect for "emulate -L" even if additional option settings are applied --- ChangeLog | 5 +++++ Src/builtin.c | 11 +++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 3db846c4b..33d8ac4c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,11 @@ * 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 + + * 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 * 36264: Src/glob.c: pathbuf is apparently metafied; document 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)); -- cgit 1.4.1 From 2ed3b84fa65b949bfea8895ab287011042fae8fb Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Fri, 21 Aug 2015 10:59:00 -0700 Subject: 36266: preserve emulation and setopt context for init and finish functions, handle vi modes --- ChangeLog | 3 +++ Functions/Zle/bracketed-paste-magic | 51 ++++++++++++++++++++++++++++++------- 2 files changed, 45 insertions(+), 9 deletions(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 33d8ac4c2..5f9ccf8e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ 2015-08-21 Barton E. Schaefer + * 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 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 -- cgit 1.4.1 From 1cfe4ca1926bc2c8041290bb0d8c3dccf8662f52 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sat, 22 Aug 2015 21:50:31 -0700 Subject: 36273: teach endofline() and endoflinehist() about invicmdmode() cursor placement. --- ChangeLog | 5 +++++ Src/Zle/zle_move.c | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 5f9ccf8e3..1cc9ff1ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-08-22 Barton E. Schaefer + + * 36273: Src/Zle/zle_move.c: teach endofline() and endoflinehist() + about invicmdmode() cursor placement. + 2015-08-21 Peter Stephenson * unposted: Config/version.mk, Src/parse.c, Src/Zle/zle_misc.c: 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; -- cgit 1.4.1 From 43079e5d8ec4e3016c380a6043c90f94fe45d72a Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sat, 22 Aug 2015 21:54:31 -0700 Subject: 36274: clear virangeflag when getvirange() has an error (the next keystroke is not a motion/selection). --- ChangeLog | 3 +++ Src/Zle/zle_vi.c | 2 ++ 2 files changed, 5 insertions(+) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 1cc9ff1ec..746caece8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-08-22 Barton E. Schaefer + * 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. 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; -- cgit 1.4.1 From 2e69ece5cfab850b8ba00b272f35ccdaf727c781 Mon Sep 17 00:00:00 2001 From: Jun-ichi Takimoto Date: Sun, 23 Aug 2015 14:31:56 +0900 Subject: users/20455: do not use posix_openpt() on OpenBSD --- ChangeLog | 5 +++++ Src/Modules/zpty.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 746caece8..c9d8e6332 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-08-23 Jun-ichi Takimoto + + * users/20455: Src/Modules/zpty.c: do not use posix_openpt() + on OpenBSD + 2015-08-22 Barton E. Schaefer * 36274: Src/Zle/zle_vi.c: clear virangeflag when getvirange() 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 -- cgit 1.4.1