'normal' doesn't trigger TextChangedI

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

'normal' doesn't trigger TextChangedI

Jason Felice
at least?  It might not trigger InsertEnter either.

I want to write tests for my plugin, so is there a better way to simulate normal input? 

Thanks,
-Jason

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 'normal' doesn't trigger TextChangedI

Christian Brabandt

On Mi, 21 Mär 2018, Jason Felice wrote:

> at least?  It might not trigger InsertEnter either.
>
> I want to write tests for my plugin, so is there a better way to simulate
> normal input? 

Try feedkeys()

Best,
Christian
--
Nein, das ist keine SchreIBMaschine!

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 'normal' doesn't trigger TextChangedI

Bram Moolenaar
In reply to this post by Jason Felice

Jason Felice wrote:

TextChangedI is only triggered on redraw and when using :normal that
doesn't happen.

> at least?  It might not trigger InsertEnter either.

AFAIK InsertEnter is triggered also when using a :normal command.

> I want to write tests for my plugin, so is there a better way to simulate
> normal input?

You can use feedkeys().

--
A day without sunshine is like, well, night.

 /// Bram Moolenaar -- [hidden email] -- 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_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 'normal' doesn't trigger TextChangedI

Jason Felice
I couldn't get feedkeys() to trigger TextChangedI either, so I've rewritten my tests to use a terminal with small delays between keystrokes, and this works.

Thanks!


On Wed, Mar 21, 2018 at 5:28 PM, Bram Moolenaar <[hidden email]> wrote:

Jason Felice wrote:

TextChangedI is only triggered on redraw and when using :normal that
doesn't happen.

> at least?  It might not trigger InsertEnter either.

AFAIK InsertEnter is triggered also when using a :normal command.

> I want to write tests for my plugin, so is there a better way to simulate
> normal input?

You can use feedkeys().

--
A day without sunshine is like, well, night.

 /// Bram Moolenaar -- [hidden email] -- 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_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 'normal' doesn't trigger TextChangedI

Lifepillar
On 23/03/2018 15:41, Jason Felice wrote:
> I couldn't get feedkeys() to trigger TextChangedI either, so I've
> rewritten my tests to use a terminal with small delays between
> keystrokes, and this works.

I have the same problem (writing tests for a plugin that uses
TextChangedI, but TextChangedI doesn't seem to be triggered when using
feedkeys()). Would you mind showing an example of how you write a test
to work around that?

Thanks,
Life.

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 'normal' doesn't trigger TextChangedI

Jason Felice
https://github.com/eraserhd/parinfer-rust/blob/master/tests/run.vim#L40-L65 is the interesting bit.

On Fri, Mar 23, 2018 at 12:30 PM, Lifepillar <[hidden email]> wrote:
On 23/03/2018 15:41, Jason Felice wrote:
I couldn't get feedkeys() to trigger TextChangedI either, so I've rewritten my tests to use a terminal with small delays between keystrokes, and this works.

I have the same problem (writing tests for a plugin that uses
TextChangedI, but TextChangedI doesn't seem to be triggered when using
feedkeys()). Would you mind showing an example of how you write a test
to work around that?

Thanks,
Life.


--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 'normal' doesn't trigger TextChangedI

Bram Moolenaar
In reply to this post by Lifepillar

Life wrote:

> On 23/03/2018 15:41, Jason Felice wrote:
> > I couldn't get feedkeys() to trigger TextChangedI either, so I've
> > rewritten my tests to use a terminal with small delays between
> > keystrokes, and this works.
>
> I have the same problem (writing tests for a plugin that uses
> TextChangedI, but TextChangedI doesn't seem to be triggered when using
> feedkeys()). Would you mind showing an example of how you write a test
> to work around that?

Also try using:
        call test_override("char_avail", 1)

--
The future isn't what it used to be.

 /// Bram Moolenaar -- [hidden email] -- 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_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 'normal' doesn't trigger TextChangedI

Lifepillar
On 23/03/2018 22:39, Bram Moolenaar wrote:

>
> Life wrote:
>
>> On 23/03/2018 15:41, Jason Felice wrote:
>>> I couldn't get feedkeys() to trigger TextChangedI either, so I've
>>> rewritten my tests to use a terminal with small delays between
>>> keystrokes, and this works.
>>
>> I have the same problem (writing tests for a plugin that uses
>> TextChangedI, but TextChangedI doesn't seem to be triggered when using
>> feedkeys()). Would you mind showing an example of how you write a test
>> to work around that?
>
> Also try using:
> call test_override("char_avail", 1)

That does it!

I was just studying Test_edit_CTRL_L(), which seems to test TextChangedI
with feedkeys(), to see how that test can pass, and noticed the call to
test_override(). It was not obvious to me that char_avail would be
related to event triggering.

Thanks,
Life



--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: 'normal' doesn't trigger TextChangedI

Lifepillar
In reply to this post by Jason Felice
On 23/03/2018 17:36, Jason Felice wrote:
> https://github.com/eraserhd/parinfer-rust/blob/master/tests/run.vim#L40-L65 
> is the interesting bit.

Thanks, cool hack! But read Bram's reply about test_override(), which
makes this workaround unnecessary.

Life.


--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.