1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-11 13:01:28 +02:00
This commit is contained in:
Peter Stephenson 2015-08-24 10:18:56 +01:00
commit 2bc4680e3b
9 changed files with 87 additions and 18 deletions

View file

@ -1,3 +1,29 @@
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.

View file

@ -27,5 +27,5 @@
# This must also serve as a shell script, so do not add spaces around the
# `=' signs.
VERSION=5.0.8-dev-1
VERSION_DATE='June 19, 2015'
VERSION=5.0.8-test-2
VERSION_DATE='August 21, 2015'

View file

@ -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

View file

@ -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>

View file

@ -738,7 +738,7 @@ yankpop(UNUSED(char **args))
}
/**/
char *
mod_export char *
bracketedstring(void)
{
static const char endesc[] = "\033[201~";

View file

@ -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;

View file

@ -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;

View file

@ -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));

View file

@ -66,7 +66,7 @@ int infor;
/* != 0 if parsing arguments of typeset etc. */
/**/
int intypeset;
mod_export int intypeset;
/* list of here-documents */