Hi Bram!

On So, 10 Apr 2016, Bram Moolenaar wrote:

> 
> Christian Brabandt wrote:
> 
> > On Do, 07 Apr 2016, Christian Brabandt wrote:
> > > Bram wrote:
> > > 
> > > > Can you give an explanation why this change is needed?
> > > 
> > > when reading the script, Vim finds the `À`,  whose second byte is the 80. 
> > > And this is K_SPECIAL in Vim source and needs to be replaced by K_SPECIAL 
> > > KS_SPECIAL KE_FILLER to be correctly parsed later in vgetorpeek when Vim 
> > > sees the K_SPECIAL and increments the offset pointer of the typebuf 
> > > struct by 2, thinking, that it needs to skip the next 2 special bytes. 
> > > But since the K_SPECIAL has not been escaped correctly, it will skip two 
> > > chars from the script file.
> > > 
> > > > When recording key strokes and playing them back, does that still work?
> > > 
> > > I will check and will try to create a test for that behaviour later when 
> > > I come up with a proper patch.
> > 
> > Here is a patch, including a test.
> > 
> > I verified, that recording and replaying works as expected. 
> > Unfortunately, replaying the macro does not work at all in the test and 
> > I am not sure why. It fails however in the unpatched and patched version 
> > the same way, so I assume, this is caused by the way the tests are 
> > executed, because when running the test interactively, it works as 
> > expected.
> 
> Thanks.
> 
> It probably requires some debugging to figure out the difference between
> doing this interactively and from a test script.  Would be worth it,
> when we add a few things specifically for testing we should be able to
> improve test coverage and avoid errors in the future.

It breaks here:

,----[ getchar.c ]-
| 2379   if (advance)    /* remove chars from tb_buf */
| 2380   {
| 2381       cmd_silent = (typebuf.tb_silent > 0);
| 2382       if (typebuf.tb_maplen > 0)
| 2383           KeyTyped = FALSE;
| 2384       else
| 2385       {
| 2386           KeyTyped = TRUE;
| 2387           /* write char to script file(s) */
| 2388           gotchars(typebuf.tb_buf
| 2389                            + typebuf.tb_off, 1);
| 2390       }
| 2391       KeyNoremap = typebuf.tb_noremap[
| 2392                                 typebuf.tb_off];
| 2393       del_typebuf(1, 0);
| 2394   }
`----

Since typebuf.tb_maplen is set, KeyTyped will be set to False. And 
gotchars() will not be called, that records the entered keys. Therefore,
recording when running the tests does not work (perhaps it works with 
feedkeys, I will check this later).

(I tried moving the gotchars() function out of the else clause, but that 
breaks test_mapping, e.g. patch 7.4.601)

Best,
Christian
-- 
F: Was sucht ein Einarmiger in einer Geschäftsstraße?
A: Einen Second-Hand-Shop

-- 
-- 
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