Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Cannot use LBUFFER+= nor print -zr from zsh/sched call
- X-seq: zsh-users 21863
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Cannot use LBUFFER+= nor print -zr from zsh/sched call
- Date: Sun, 11 Sep 2016 12:35:25 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=TnFQLqZNuLy1yOkCNCqO8A0CI4F9UGULbDSpyEhPwsM=; b=Mm6fA73jacg8YhSFg2ockNI1iqEsm2VMgH7Icg/21/OJO2qjOnGfDIm+osEYUKhf2M 4AM4fCqB4FnWGY+SSLPDfXu8aD+vGflxNvrnchtskwbi4XTpuZDHBVu/woOY78Fe7ehT OjOwSg668hpCs1ZbpboWSAo4xfUPUF2tj3GreuIfbQFaahs3bNSiieYnw7Wcamn5bPb2 bnVn+MtPabDZlccDWSAwL+cCZZXqOyEzP5858mNPJDnRVlDjZ3SAB5c3/Q3ItPWz5rRx ur+B32iFhFqwOBSPVxdiJvtMPnUUNNDUexZFRDSBzP98ZLCXAVOZ39ZZ5QjCn3LIJOKo pTVg==
- In-reply-to: <CAKc7PVCiy_phpQb=DTR-Td5ktDL2cDK=y_tUE3bTXVXVTm2AXA@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVCiy_phpQb=DTR-Td5ktDL2cDK=y_tUE3bTXVXVTm2AXA@mail.gmail.com>
I've added a simple TIOCSTI based program:
void output( char *cmd ) {
if ( cmd && strlen( cmd ) > 0 ) {
size_t size = strlen( cmd );
unsigned int i;
char *c;
for (i = 0; i < size; i++) {
c = cmd + i;
ioctl( 0, TIOCSTI, c );
}
printf("\n");
}
}
https://github.com/psprint/zconvey/blob/master/feeder/feeder.c#L15-L26
It works great compared to previous LBUFFER+= etc. attempts. However,
there is a problem with obtaining accept-line. If I use '\n' in
feeder.c, the line gets accepted, but not from sched call. A zle
.accept-line will work for e.g. "echo" or "ls" commands but with
errors (takes only first characters). How to find exit from this?
Also, could some update be done to Zsh, so that Zsh 5.3 will be
workaround-less?
The behavior currently:
https://asciinema.org/a/7yw5jq656tfmqzt1yhkrhcd6n
Best regards,
Sebastian Gniazdowski
On 11 September 2016 at 11:28, Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
> Hello,
> I do:
>
> zle .redisplay
> zle .kill-buffer
> LBUFFER+="${(j:; :)commands[@]}"
> print -zr "${(j:; :)commands[@]}"
> print -rl -- "${commands[@]}"
>
> And command line isn't feed with the $commands. Whole code:
>
> https://github.com/psprint/zconvey/blob/dc2656f1f8a91c7af03d344eab34644dfb8b96c3/zconvey.plugin.zsh#L183-L188
>
>
> Is there workaround? How to feed commands to command line from sched call?
>
> Best regards,
> Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author