* Re: zle -R glitch
@ 2000-01-13 9:58 Sven Wischnowsky
0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2000-01-13 9:58 UTC (permalink / raw)
To: zsh-workers; +Cc: Johan Sundström
I wrote:
> =?ISO-8859-1?Q?Johan_Sundstr=F6m?= wrote:
>
> > Hi!
> >
> > I just had a peek at the new (to me, at least) widget system, and
> > impressed as I am, I found something that might need some fixing. As
> > an exercise, I tried implementing a "what-line" function:
> >
> > function what-line () { zle -R "Line $HISTNO" }
> > zle -N what-line
> > ...
>
> That's how it should be. Note that the manual says that the string is
> displayed in the status line which is used by widgets to display
> strings *while the widget is active* (like M-x and some others do it).
Oops. Leaving the string displayed was, of course, already possible. Kinda.
function what-line () {
local key
zle -R "Line $HISTNO"
read -k key
zle -U "$key"
}
Hm. But the -M option is probably still good to have.
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: zle -R glitch
@ 2000-01-13 9:20 Sven Wischnowsky
2000-01-17 12:20 ` Johan Sundström
0 siblings, 1 reply; 4+ messages in thread
From: Sven Wischnowsky @ 2000-01-13 9:20 UTC (permalink / raw)
To: zsh-workers; +Cc: Johan Sundström
=?ISO-8859-1?Q?Johan_Sundstr=F6m?= wrote:
> Hi!
>
> I just had a peek at the new (to me, at least) widget system, and
> impressed as I am, I found something that might need some fixing. As
> an exercise, I tried implementing a "what-line" function:
>
> function what-line () { zle -R "Line $HISTNO" }
> zle -N what-line
>
> ...but when I try it out (M-x what-line), I am barely able to make out the
> output before it is flashed away again. Setting up keyboard repeat rate
> and keeping M-z down for a while confirmed that the function seems to work
> otherwise, but I would have expected the function to work more like the
> what-cursor-position, that is, to stay visible on the status line.
That's how it should be. Note that the manual says that the string is
displayed in the status line which is used by widgets to display
strings *while the widget is active* (like M-x and some others do it).
However, I hadn't looked at w-c-p, otherwise I would have added an
option-interface to showmsg() immediatly.
So, the patch below adds the -M option to the zle builtin which allows
to give a string that will be displayed below the prompt that will
stay there when the widget returns. I prefer to use a different option
for this instead of changing -R because it makes the list-display
feature of -R easier (using only code that already exists anyway).
Bye
Sven
diff -ru ../z.old/Doc/Zsh/mod_zle.yo Doc/Zsh/mod_zle.yo
--- ../z.old/Doc/Zsh/mod_zle.yo Thu Jan 13 09:57:47 2000
+++ Doc/Zsh/mod_zle.yo Thu Jan 13 10:10:55 2000
@@ -180,6 +180,7 @@
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) [ tt(-c) ] [ var(display-string) ] [ var(string) ... ])
+xitem(tt(zle) tt(-M) 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
@@ -241,6 +242,17 @@
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.
+
+Note that this option is only useful for widgets that do not exit
+immediatly after using it because the strings displayed will be erased
+immediatly after return from the widget.
+)
+item(tt(-M) var(string))(
+As with the tt(-R) option, the var(string) will be displayed below the
+command line. But unlike the tt(-R) option the string not be put into
+the status line but will instead be printed normally below the
+prompt. This means that the var(string) will still be displayed after
+the widget returns (until it is overwritten by subsequent commands).
)
item(tt(-U) var(string))(
This puts the characters in the var(string) in the input queue of
diff -ru ../z.old/Src/Zle/zle_thingy.c Src/Zle/zle_thingy.c
--- ../z.old/Src/Zle/zle_thingy.c Thu Jan 13 10:12:08 2000
+++ Src/Zle/zle_thingy.c Thu Jan 13 10:04:04 2000
@@ -337,6 +337,7 @@
{ 'N', bin_zle_new, 1, 2 },
{ 'C', bin_zle_complete, 3, 3 },
{ 'R', bin_zle_refresh, 0, -1 },
+ { 'M', bin_zle_mesg, 1, 1 },
{ 'U', bin_zle_unget, 1, 1 },
{ 0, bin_zle_call, 0, -1 },
};
@@ -426,6 +427,14 @@
clearlist = ocl;
statusline = s;
statusll = sl;
+ return 0;
+}
+
+/**/
+static int
+bin_zle_mesg(char *name, char **args, char *ops, char func)
+{
+ showmsg(*args);
return 0;
}
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: zle -R glitch
2000-01-13 9:20 Sven Wischnowsky
@ 2000-01-17 12:20 ` Johan Sundström
0 siblings, 0 replies; 4+ messages in thread
From: Johan Sundström @ 2000-01-17 12:20 UTC (permalink / raw)
To: zsh-workers
Hi again!
I must say I was more than a bit impressed by the quick and handy response
to my message a few days ago (and thanks for the backwards-compatible hint
too ;-). A few days of reading the manual later, I thought I might
contribute at least an occasional tiny documentation fix, but it seems
rather proof-read indeed. Here's all I've found to date:
diff -c Doc/Zsh/compwid.yo Doc/Zsh/compwid.fix.yo
*** Doc/Zsh/compwid.yo Wed Jan 12 19:38:06 2000
--- Doc/Zsh/compwid.fix.yo Mon Jan 17 13:06:00 2000
***************
*** 937,943 ****
after typing control-X and TAB. The function should then generate the
matches, e.g.:
! example(complete-filles LPAR()RPAR() { compadd - * })
This function will complete files in the current directory matching the
current word.
--- 937,943 ----
after typing control-X and TAB. The function should then generate the
matches, e.g.:
! example(complete-files LPAR()RPAR() { compadd - * })
This function will complete files in the current directory matching the
current word.
With gratitude,
Johan Sundström
^ permalink raw reply [flat|nested] 4+ messages in thread
* zle -R glitch
@ 2000-01-13 4:00 Johan Sundström
0 siblings, 0 replies; 4+ messages in thread
From: Johan Sundström @ 2000-01-13 4:00 UTC (permalink / raw)
To: zsh-workers
Hi!
I just had a peek at the new (to me, at least) widget system, and
impressed as I am, I found something that might need some fixing. As
an exercise, I tried implementing a "what-line" function:
function what-line () { zle -R "Line $HISTNO" }
zle -N what-line
...but when I try it out (M-x what-line), I am barely able to make out the
output before it is flashed away again. Setting up keyboard repeat rate
and keeping M-z down for a while confirmed that the function seems to work
otherwise, but I would have expected the function to work more like the
what-cursor-position, that is, to stay visible on the status line.
(For the record: Tested with an own build of 3.1.6-dev-14 as well as the
Linux Mandrake zsh-3.1.6-10mdk rpm)
I'd appreciate being cc:ed any postings, since I'm not on the list.
/Johan Sundström, happily playing with the new featuress in zsh 3.1.6
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-01-17 12:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-13 9:58 zle -R glitch Sven Wischnowsky
-- strict thread matches above, loose matches on Subject: below --
2000-01-13 9:20 Sven Wischnowsky
2000-01-17 12:20 ` Johan Sundström
2000-01-13 4:00 Johan Sundström
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).