Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Cannot use LBUFFER+= nor print -zr from zsh/sched call



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