* Zsh Bug Report: vi mode inner motions diw and ciw incorrect @ 2017-05-31 21:49 John Kaczor 2017-06-01 2:26 ` Jun T. 0 siblings, 1 reply; 4+ messages in thread From: John Kaczor @ 2017-05-31 21:49 UTC (permalink / raw) To: zsh-workers [-- Attachment #1: Type: text/plain, Size: 784 bytes --] In zsh version 5.3.1 vi-cmd-mode, typing diw when the cursor is at the end of "/path/to/dir" deletes the entire string instead of just "dir". The motions diw and ciw seem to only use whitespace delimiters now instead of mimicking vim's word characters. ________________________________ This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this email in error please notify our system management at postmaster@optiver.com and immediately and permanently delete this message and any attachments. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Zsh Bug Report: vi mode inner motions diw and ciw incorrect 2017-05-31 21:49 Zsh Bug Report: vi mode inner motions diw and ciw incorrect John Kaczor @ 2017-06-01 2:26 ` Jun T. 2017-06-01 13:19 ` John Kaczor 0 siblings, 1 reply; 4+ messages in thread From: Jun T. @ 2017-06-01 2:26 UTC (permalink / raw) To: zsh-workers; +Cc: John Kaczor On 2017/06/01, at 6:49, John Kaczor <johnkaczor@Optiver.com> wrote: > In zsh version 5.3.1 vi-cmd-mode, typing diw when the cursor is at the end of "/path/to/dir" deletes the entire string instead of just "dir". I can't reproduce this. Please try the following bindkey command to see "iw" is actually bound to select-in-word. zsh% bindkey -M viopp iw "iw" select-in-word ^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Zsh Bug Report: vi mode inner motions diw and ciw incorrect 2017-06-01 2:26 ` Jun T. @ 2017-06-01 13:19 ` John Kaczor 2017-06-01 14:15 ` Peter Stephenson 0 siblings, 1 reply; 4+ messages in thread From: John Kaczor @ 2017-06-01 13:19 UTC (permalink / raw) To: Jun T., zsh-workers 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. My zshrc: bindkey -v bindkey -M viins 'jk' vi-cmd-mode source $HOME/.zsh/plugins/substring-search/zsh-history-substring-search.zsh -----Original Message----- From: Jun T. [mailto:takimoto-j@kba.biglobe.ne.jp] Sent: Wednesday, May 31, 2017 9:27 PM To: zsh-workers@zsh.org Cc: John Kaczor <johnkaczor@Optiver.com> Subject: Re: Zsh Bug Report: vi mode inner motions diw and ciw incorrect [External] On 2017/06/01, at 6:49, John Kaczor <johnkaczor@Optiver.com> wrote: > In zsh version 5.3.1 vi-cmd-mode, typing diw when the cursor is at the end of "/path/to/dir" deletes the entire string instead of just "dir". I can't reproduce this. Please try the following bindkey command to see "iw" is actually bound to select-in-word. zsh% bindkey -M viopp iw "iw" select-in-word ________________________________ This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this email in error please notify our system management at postmaster@optiver.com and immediately and permanently delete this message and any attachments. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Zsh Bug Report: vi mode inner motions diw and ciw incorrect 2017-06-01 13:19 ` John Kaczor @ 2017-06-01 14:15 ` Peter Stephenson 0 siblings, 0 replies; 4+ messages in thread From: Peter Stephenson @ 2017-06-01 14:15 UTC (permalink / raw) To: zsh-workers 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; ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-06-01 14:15 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-05-31 21:49 Zsh Bug Report: vi mode inner motions diw and ciw incorrect John Kaczor 2017-06-01 2:26 ` Jun T. 2017-06-01 13:19 ` John Kaczor 2017-06-01 14:15 ` Peter Stephenson
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).