* Re: PATCH: more fun with `zle'
@ 1999-07-07 7:51 Sven Wischnowsky
1999-07-07 8:13 ` Andrej Borsenkow
0 siblings, 1 reply; 4+ messages in thread
From: Sven Wischnowsky @ 1999-07-07 7:51 UTC (permalink / raw)
To: zsh-workers
I forgot to say: this also adds`zle -U string' which puts the
characters from `string' back into the input-loop.
And: all of this is only a suggestion for things that may be
interesting to have. I'm not really happy with the argument-parsing
and -naming of `zle' (and I never really understood why we have to
have the concept of a widget -- maybe a special builtin/shell
function-type would be more appropriate nowadays; but that's a
different story).
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: PATCH: more fun with `zle'
1999-07-07 7:51 PATCH: more fun with `zle' Sven Wischnowsky
@ 1999-07-07 8:13 ` Andrej Borsenkow
1999-07-07 8:27 ` Chain widgets call (was: RE: PATCH: more fun with `zle') Andrej Borsenkow
0 siblings, 1 reply; 4+ messages in thread
From: Andrej Borsenkow @ 1999-07-07 8:13 UTC (permalink / raw)
To: Sven Wischnowsky, zsh-workers
>
> And: all of this is only a suggestion for things that may be
> interesting to have. I'm not really happy with the argument-parsing
> and -naming of `zle' (and I never really understood why we have to
> have the concept of a widget -- maybe a special builtin/shell
> function-type would be more appropriate nowadays; but that's a
> different story).
>
As I understand it, it gives you additional flexibility. You can have a single
function that is linked to more than one widget. Widget name is available so
function can behave differently. Currently I have e.g. function
((${+NUMERIC})) || zle .set-local-history
if [[ $WIDGET == .* ]]
then
zle $WIDGET
else
zle .$WIDGET
fi
((${+NUMERIC})) || zle .set-local-history
and redefine all *history* widgets to use this function. Implementing the same
directly as function would depend on FUNCTIONARGZERO setting.
/andrej
^ permalink raw reply [flat|nested] 4+ messages in thread
* Chain widgets call (was: RE: PATCH: more fun with `zle')
1999-07-07 8:13 ` Andrej Borsenkow
@ 1999-07-07 8:27 ` Andrej Borsenkow
0 siblings, 0 replies; 4+ messages in thread
From: Andrej Borsenkow @ 1999-07-07 8:27 UTC (permalink / raw)
To: zsh-workers
>
> ((${+NUMERIC})) || zle .set-local-history
> if [[ $WIDGET == .* ]]
> then
> zle $WIDGET
> else
> zle .$WIDGET
> fi
> ((${+NUMERIC})) || zle .set-local-history
>
And looking at this I realised, that it has some basic problem. Every other
*history* widget could already be redefined to whatever you like. What I want to
do is ismply to set special environment and call _original_ widget ... that is
not quite the same as calling .immortal version. But there is no way to "chain"
definitions ... Doing it would probably mean
- special syntax to "push" instead of "replace" definition
- special syntax with meaning "call previous definition for current widget"
And the question is, how generally useful is it at all?
/andrej
^ permalink raw reply [flat|nested] 4+ messages in thread
* PATCH: more fun with `zle'
@ 1999-07-07 7:12 Sven Wischnowsky
0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 1999-07-07 7:12 UTC (permalink / raw)
To: zsh-workers
Instead of trying to fix the stuff reported 6950 or trying to improve
_oldlist for 6958 I just played a bit with user-defined widgets. Here
is one result:
This allows `zle -R' to take a list of words (after the statusline-
string) and makes these words be listed under the prompt like a
completion list (it's a interface for the listlist() function).
It also adds the `-c' flag that can be combined with `-R' to get rid
of such a list.
While playing with this I noticed a bug with things like execute-named-
command: if you do `M-x <TAB> ^L' listmatches() gets called with a
invalid list (and -- with debugging enabled -- says so). I don't have
a working 3.0.6 version any more, but I guess this can be in there,
too. So, Bart: the hunks that only add a `showinglist = 0' should
probably applied to it.
(Examples for the new stuff will follow...)
Bye
Sven
diff -u -r kos/Zle/zle_main.c Src/Zle/zle_main.c
--- kos/Zle/zle_main.c Wed Jul 7 08:50:32 1999
+++ Src/Zle/zle_main.c Wed Jul 7 08:58:59 1999
@@ -948,7 +948,7 @@
static struct builtin bintab[] = {
BUILTIN("bindkey", 0, bin_bindkey, 0, -1, 0, "evaMldDANmrsLR", NULL),
BUILTIN("vared", 0, bin_vared, 1, 7, 0, NULL, NULL),
- BUILTIN("zle", 0, bin_zle, 0, -1, 0, "lDANCLmMgGcRa", NULL),
+ BUILTIN("zle", 0, bin_zle, 0, -1, 0, "lDANCLmMgGcRaU", NULL),
};
/* The order of the entries in this table has to match the *HOOK
diff -u -r kos/Zle/zle_misc.c Src/Zle/zle_misc.c
--- kos/Zle/zle_misc.c Wed Jul 7 08:50:32 1999
+++ Src/Zle/zle_misc.c Wed Jul 7 08:58:59 1999
@@ -736,6 +736,7 @@
statusll = l + len + 1;
zmult = 1;
listlist(cmdll);
+ showinglist = 0;
zmult = zmultsav;
} else if (!nextnode(firstnode(cmdll))) {
strcpy(ptr = cmdbuf, peekfirst(cmdll));
@@ -754,6 +755,7 @@
statusll = l + cmdambig + 1;
zmult = 1;
listlist(cmdll);
+ showinglist = 0;
zmult = zmultsav;
}
len = cmdambig;
diff -u -r kos/Zle/zle_thingy.c Src/Zle/zle_thingy.c
--- kos/Zle/zle_thingy.c Wed Jul 7 08:50:32 1999
+++ Src/Zle/zle_thingy.c Wed Jul 7 08:58:59 1999
@@ -340,7 +340,8 @@
{ 'A', bin_zle_link, 2, 2 },
{ 'N', bin_zle_new, 1, 2 },
{ 'C', bin_zle_complete, 3, 3 },
- { 'R', bin_zle_refresh, 0, 1 },
+ { 'R', bin_zle_refresh, 0, -1 },
+ { 'U', bin_zle_unget, 1, 1 },
{ 0, bin_zle_call, 0, -1 },
};
struct opn const *op, *opp;
@@ -396,19 +397,46 @@
bin_zle_refresh(char *name, char **args, char *ops, char func)
{
char *s = statusline;
- int sl = statusll;
+ int sl = statusll, ocl = clearlist;
+ statusline = NULL;
+ statusll = 0;
if (*args) {
- statusline = *args;
- statusll = strlen(statusline);
- } else {
- statusline = NULL;
- statusll = 0;
- }
+ if (**args) {
+ statusline = *args;
+ statusll = strlen(statusline);
+ }
+ if (*++args) {
+ LinkList l = newlinklist();
+ int zmultsav = zmult;
+
+ for (; *args; args++)
+ addlinknode(l, *args);
+
+ zmult = 1;
+ listlist(l);
+ showinglist = clearlist = 0;
+ zmult = zmultsav;
+ } else if (ops['c'])
+ clearlist = 1;
+ } else if (ops['c'])
+ clearlist = 1;
zrefresh();
+ clearlist = ocl;
statusline = s;
statusll = sl;
+ return 0;
+}
+
+/**/
+static int
+bin_zle_unget(char *name, char **args, char *ops, char func)
+{
+ char *p = *args;
+
+ while (*p)
+ ungetkey((int) *p++);
return 0;
}
diff -u -r kos/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- kos/Zle/zle_tricky.c Wed Jul 7 08:50:33 1999
+++ Src/Zle/zle_tricky.c Wed Jul 7 08:59:00 1999
@@ -1773,6 +1773,7 @@
if (lst == COMP_LIST_EXPAND) {
/* Only the list of expansions was requested. */
listlist(vl);
+ showinglist = 0;
goto end;
}
/* Remove the current word and put the expansions there. */
diff -u -r kod/Zsh/mod_zle.yo Doc/Zsh/mod_zle.yo
--- kod/Zsh/mod_zle.yo Wed Jul 7 08:50:41 1999
+++ Doc/Zsh/mod_zle.yo Wed Jul 7 08:59:00 1999
@@ -177,7 +177,8 @@
xitem(tt(zle) tt(-A) var(old-widget) var(new-widget))
xitem(tt(zle) tt(-N) var(widget) [ var(function) ])
xitem(tt(zle) tt(-C) var(widget) var(completion-widget) var(function))
-xitem(tt(zle) tt(-R) [ var(display-string) ])
+xitem(tt(zle) tt(-R) [ tt(-c) ] [ var(display-string) ] [ var(string) ... ])
+xitem(tt(zle) tt(-U) var(string))
item(tt(zle) var(widget) tt([ -n) var(num) tt(]) tt([ -N ]) var(args) ...)(
The tt(zle) builtin performs a number of different actions concerning
ZLE. Which operation it performs depends on its options:
@@ -227,11 +228,21 @@
ifnzman(noderef(Completion Widgets))\
.
)
-item(tt(-R) [ var(display-string) ])(
+item(tt(-R) [ tt(-c) ] [ var(display-string) ] [ var(string) ... ])(
Redisplay the command line; this is to be called from within a user-defined
widget to allow changes to become visible. If a var(display-string) is
-given, this is shown in the status line (immediately below the line being
-edited).
+given and not empty, this is shown in the status line (immediately
+below the line being edited).
+
+If the optional var(string)s are given they are listed below the
+prompt in the same way as completion lists are printed. If no
+var(string)s are given but the tt(-c) option is used such a list is
+cleared.
+)
+item(tt(-U) var(string))(
+This puts the characters in the var(string) in the input queue of
+ZLE. After the widget currently executed finishes ZLE will behave as
+if the characters in the var(string) were typed by the user.
)
item(var(widget) tt([ -n) var(num) tt(]) tt([ -N ]) var(args) ...)(
Invoke the specified widget. This can only be done when ZLE is
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1999-07-07 8:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-07 7:51 PATCH: more fun with `zle' Sven Wischnowsky
1999-07-07 8:13 ` Andrej Borsenkow
1999-07-07 8:27 ` Chain widgets call (was: RE: PATCH: more fun with `zle') Andrej Borsenkow
-- strict thread matches above, loose matches on Subject: below --
1999-07-07 7:12 PATCH: more fun with `zle' Sven Wischnowsky
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).