From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1784 invoked from network); 13 Jan 2000 09:20:42 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 13 Jan 2000 09:20:42 -0000 Received: (qmail 21667 invoked by alias); 13 Jan 2000 09:20:36 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9306 Received: (qmail 21660 invoked from network); 13 Jan 2000 09:20:36 -0000 Date: Thu, 13 Jan 2000 10:20:32 +0100 (MET) Message-Id: <200001130920.KAA06915@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk CC: =?ISO-8859-1?Q?Johan_Sundstr=F6m?= In-reply-to: =?ISO-8859-1?Q?Johan_Sundstr=F6m?='s message of Thu, 13 Jan 2000 05:00:36 +0100 (MET) Subject: Re: zle -R glitch =?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