From: Peter Stephenson <p.stephenson@samsung.com>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: Zsh Bug Report: vi mode inner motions diw and ciw incorrect
Date: Thu, 01 Jun 2017 15:15:28 +0100 [thread overview]
Message-ID: <20170601151528.4d0aad32@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <559FA8F10BF2244B9DA5E70F5B6BA9A00112A312C2@OPCHMS0002.comp.optiver.com>
On Thu, 1 Jun 2017 13:19:02 +0000
John Kaczor <johnkaczor@Optiver.com> wrote:
> bindkey -M viopp iw
> Outputs
> "iw" select-in-word
>
> I cut down my zshrc to a minimal version that reproduces the issue.
> It appears to only occur once I have sourced
> zsh-history-substring-search.zsh. I cloned the latest version of this
> plugin. Also, zsh 5.0.8 works as expected even when sourcing
> zsh-history-substring-search.zsh, but zsh 5.3.1 does not.
I don't know that function or where it comes from, but I can see one
problem that's going to make things difficulty, namely it doesn't test
for the equivalent "immortal" binding.
(FAOD: this new test isn't needed for t_undefinedkey which is passed
around specially internally.)
pws
diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo
index aa7a1a4..0b09ded 100644
--- a/Completion/Unix/Command/_sudo
+++ b/Completion/Unix/Command/_sudo
@@ -41,6 +41,8 @@ if [[ $service = sudoedit ]] || (( $words[(i)-e] < $words[(i)^(*sudo|-[^-]*)] ))
args=( -A "-*" $args '!(-V --version -h --help)-e' '*:file:_files' )
else
cmd="$words[1]"
+ local ext
+ (( ${words[(I)-[is]]} == 0 )) && ext=" -e"
args+=(
'(-e --edit 1 *)'{-e,--edit}'[edit files instead of running a command]' \
'(-s --shell)'{-s,--shell}'[run shell as the target user; a command may also be specified]' \
@@ -49,7 +51,7 @@ else
'(-E --preserve-env -i --login -s --shell -e --edit)'{-E,--preserve-env}'[preserve user environment when running command]' \
'(-H --set-home -i --login -s --shell -e --edit)'{-H,--set-home}"[set HOME variable to target user's home dir]" \
'(-P --preserve-groups -i -login -s --shell -e --edit)'{-P,--preserve-groups}"[preserve group vector instead of setting to target's]" \
- '(-)1:command: _command_names -e'
+ "(-)1:command: _command_names$ext"
'*::arguments:{ _comp_priv_prefix=( $cmd -n ${(kv)opt_args[(I)(-[ugHEP]|--(user|group|set-home|preserve-env|preserve-groups))]} ) ; _normal }'
)
fi
diff --git a/Src/Zle/textobjects.c b/Src/Zle/textobjects.c
index 3db0781..bf83906 100644
--- a/Src/Zle/textobjects.c
+++ b/Src/Zle/textobjects.c
@@ -48,9 +48,10 @@ int
selectword(UNUSED(char **args))
{
int n = zmult;
- int all = (bindk == t_selectaword || bindk == t_selectablankword);
- int (*viclass)(ZLE_CHAR_T) = (bindk == t_selectaword ||
- bindk == t_selectinword) ? wordclass : blankwordclass;
+ int all = IS_THINGY(bindk, selectaword) ||
+ IS_THINGY(bindk, selectablankword);
+ int (*viclass)(ZLE_CHAR_T) = (IS_THINGY(bindk, selectaword) ||
+ IS_THINGY(bindk, selectinword)) ? wordclass : blankwordclass;
int sclass = viclass(zleline[zlecs]);
int doblanks = all && sclass;
@@ -288,7 +289,7 @@ selectargument(UNUSED(char **args))
free(stringaszleline(linein, wstarts[wcur], &zlecs, &tmpsz, &mark));
free(linein);
- if (bindk == t_selectinshellword) {
+ if (IS_THINGY(bindk, selectinshellword)) {
ZLE_CHAR_T *match = ZWS("`\'\"");
ZLE_CHAR_T *lmatch = ZWS("\'({"), *rmatch = ZWS("\')}");
ZLE_CHAR_T *ematch = match, *found;
diff --git a/Src/Zle/zle.h b/Src/Zle/zle.h
index 8f92e56..07b3101 100644
--- a/Src/Zle/zle.h
+++ b/Src/Zle/zle.h
@@ -230,6 +230,13 @@ struct thingy {
/* DISABLED is (1<<0) */
#define TH_IMMORTAL (1<<1) /* can't refer to a different widget */
+/*
+ * Check if bindk refers to named thingy (a set of bare characters),
+ * also checking the special .thingy widget.
+ */
+#define IS_THINGY(bindk, name) \
+ ((bindk) == t_ ## name || (bindk) == t_D ## name)
+
/* command modifier prefixes */
struct modifier {
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index 04eb706..2e96ac7 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -961,7 +961,7 @@ bin_bindkey_meta(char *name, char *kmname, Keymap km, UNUSED(char **argv), UNUSE
m[0] = i;
metafy(m, 1, META_NOALLOC);
fn = keybind(km, m, &str);
- if(fn == t_selfinsert || fn == t_undefinedkey)
+ if(IS_THINGY(fn, selfinsert) || fn == t_undefinedkey)
bindkey(km, m, refthingy(Th(metabind[i - 128])), NULL);
}
return 0;
prev parent reply other threads:[~2017-06-01 14:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-31 21:49 John Kaczor
2017-06-01 2:26 ` Jun T.
2017-06-01 13:19 ` John Kaczor
2017-06-01 14:15 ` Peter Stephenson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170601151528.4d0aad32@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).