diff options
author | Peter Stephenson <pws@zsh.org> | 2015-10-01 09:44:56 +0100 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2015-10-01 09:44:56 +0100 |
commit | 8877783b2f98de67144f403e0146b6d201e98ba3 (patch) | |
tree | c8fe6c4d4fc6d7c93119c01cc300427655001ba3 /Src/Zle/zle_thingy.c | |
parent | 007f249a8e190306a9ef6bca2317e79004ace871 (diff) | |
parent | bc2e73ba4c27a220a6f122cb7b9b5c6fa9996941 (diff) | |
download | zsh-8877783b2f98de67144f403e0146b6d201e98ba3.tar.gz zsh-8877783b2f98de67144f403e0146b6d201e98ba3.tar.xz zsh-8877783b2f98de67144f403e0146b6d201e98ba3.zip |
Merge branch 'master' of https://git.code.sf.net/p/zsh/code
Diffstat (limited to 'Src/Zle/zle_thingy.c')
-rw-r--r-- | Src/Zle/zle_thingy.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c index da3a6d458..3963d7eaf 100644 --- a/Src/Zle/zle_thingy.c +++ b/Src/Zle/zle_thingy.c @@ -352,6 +352,7 @@ bin_zle(char *name, char **args, Options ops, UNUSED(int func)) { 'U', bin_zle_unget, 1, 1 }, { 'K', bin_zle_keymap, 1, 1 }, { 'I', bin_zle_invalidate, 0, 0 }, + { 'f', bin_zle_flags, 1, -1 }, { 'F', bin_zle_fd, 0, 2 }, { 'T', bin_zle_transform, 0, 2}, { 0, bin_zle_call, 0, -1 }, @@ -625,6 +626,44 @@ bin_zle_complete(char *name, char **args, UNUSED(Options ops), UNUSED(char func) /**/ static int +bin_zle_flags(char *name, char **args, UNUSED(Options ops), UNUSED(char func)) +{ + char **flag; + + if (!zle_usable()) { + zwarnnam(name, "can only set flags from a widget"); + return 1; + } + + if (bindk) { + Widget w = bindk->widget; + if (w) { + for (flag = args; *flag; flag++) { + if (!strcmp(*flag, "yank")) { + w->flags |= ZLE_YANKAFTER; + } else if (!strcmp(*flag, "yankbefore")) + w->flags |= ZLE_YANKBEFORE; + else if (!strcmp(*flag, "kill")) + w->flags |= ZLE_KILL; + /* + * These won't do anything yet, because of how execzlefunc + * handles user widgets + } else if (!strcmp(*flag, "menucmp")) + w->flags |= ZLE_MENUCMP; + else if (!strcmp(*flag, "linemove")) + w->flags |= ZLE_LINEMOVE; + else if (!strcmp(*flag, "keepsuffix")) + w->flags |= ZLE_KEEPSUFFIX; + */ + else + zwarnnam(name, "invalid flag `%s' given to zle -f", *flag); + } + } + } +} + +/**/ +static int zle_usable() { return zleactive && !incompctlfunc && !incompfunc |