Paul Jolly wrote:

> > OK, so the whole sequence is triggered by the balloon eval
> > functionality.  This happens in check_due_timer().  That's a fairly
> > normal way a callback is invoked, in this case evaluating 'balloonexpr'.
> 
> Ok, thanks.
> 
> > You can see in line 409:
> >   0.181045 : safe state reset
> >
> > That's why it stops triggering SafeStateAgain.  This is after a call to
> > s:define(), that is that doing?  Somehow it doesn't go back to the main
> > loop to check the state.
> 
> All callbacks we make from Vim -> govim use ch_evalexpr, for
> autocommands, commands, functions, listener_add callbacks etc. That is
> they all block. This makes reasoning about things much easier. If
> anything needs to happen async we make that decision within govim.
> 
> Similarly for calls from govim -> Vim we block on the govim side; we
> then use ch_sendexpr to reply from Vim with an [error(, result)]
> array:
> 
> https://github.com/govim/govim/blob/e8054412bdbc5c2fd232a56fdc79ca4fc6082312/plugin/govim.vim#L221
> 
> So lines 408-410:
> 
>   0.180945 on 0: Invoking channel callback <SNR>17_define
>   0.181045 : safe state reset
>   0.181146 SEND on 0(sock): '[49,["callback",45,[""]]]
> 
> is the "response" to govim from the call from line 404:
> 
>   0.180915 RECV on 0(sock): '[0,[45,"ex","call
> feedkeys(\"\\\u003cMouseMove\u003e\\\u003cIgnore\u003e\", \"xt\")"]]
> 
> (you can see we also have an ID in there)
> 
> Hopefully that help to clarify things?

OK, so the feedkeys() causes the safe state to be reset.  That is
correct, since Vim is then busy with processing input, which isn't
considered safe.

The problem is that with the "xt" argument to feedkeys() the input is
processed right away, and we don't return to the main loop.  I guess
that we should check for a safe state at the start of feedkeys(), and if
it's true and the input has been processed, check if it's still safe.

-- 
Facepalm statement #7: "Last week I almost got pregnant!"

 /// 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/201909181449.x8IEntmB013087%40masaka.moolenaar.net.

Raspunde prin e-mail lui