Nikolay Pavlov wrote:

> 2018-03-25 1:04 GMT+03:00 Bram Moolenaar <[email protected]>:
> >
> > I wrote:
> >
> >> One piece of functionality that is missing from the terminal feature is
> >> for the job in the terminal to communcate back to Vim.  It is possible
> >> with the client-server feature, but that is not always available and
> >> isn't easy to use.
> >
> > [...]
> >
> >> Currently supported commands:
> >>
> >> call {funcname} {argument}
> >>
> >>       Call a user defined function with [argument].  This does not work to
> >>       call built-in functions to avoid security issues.
> >>       [argument] is decoded and passed to the function.  Thus the function
> >>       must accept one argument.  The user function must sanity check the
> >>       argument.  The function can use |term_sendkeys()| to send back a
> >>       reply.
> >>       Example in JSON: >
> >>               ["call", "Impression", ["play", 14]]
> >
> > The first argument of the function shall be the buffer number of the
> > terminal window.  For the example the function could be:
> >
> >         function Impression(bufnum, arglist)
> >           if len(a:arglist) == 2
> >             echo "impression " . a:arglist[0]
> >             echo "count " . a:arglist[1]
> >           endif
> >         endfunc
> 
> By the way, when function is going to be run exactly? When timers do?

Like all other Job output, it is given to libvterm to decode.  libvterm
will then invoke a callback for this specific escape sequence, and Vim
will decode it and call the function.  Thus it's similar to a callback
invoked when a message arrives on a channel.

-- 
"I can't complain, but sometimes I still do."   (Joe Walsh)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui