Jacob Niehus wrote:
> This bug can be reproduced as follows. Run vim with:
>
> vim -u NONE -i NONE -c 'set nocp bt=nofile' -c 'norm 10ablah ' -c 'norm 0' -c
> 'nnoremap <M-d> d' -c 'set <M-d>=<Esc>d'
>
> Then run ':exe "norm fb\<M-d>w"'. It should go to the next 'b' and delete the
> word, but it doesn't delete the word. The same problem happens if the <M-d>
> is in a recording, which is how I first encountered it. ':exe "norm \<M-d>w"'
> works as expected.
>
> The bug is in the normal_cmd function in normal.c. After a seek command, it
> checks if there is a multibyte character next in the typeahead. It reads it
> and tries to put it back, but that fails because it was not read correctly
> because it doesn't set no_mapping to zero for vgetorpeek. The patch fixes
> that and solves the bug described.
>
> I also tested the change by repeating the steps above with 'ンlah' instead of
> 'blah' as the word, and with 'ン' instead <M-d> as the map, and it held up
> (i.e. didn't work before the patch, but now does work) in both cases. That
> said, I'm not familiar with the multibyte functionality so check my work.
>
> diff --git a/src/normal.c b/src/normal.c
> --- a/src/normal.c
> +++ b/src/normal.c
> @@ -1077,6 +1077,7 @@
> /* When getting a text character and the next character is a
> * multi-byte character, it could be a composing character.
> * However, don't wait for it to arrive. */
> + --no_mapping;
> while (enc_utf8 && lang && (c = vpeekc()) > 0
> && (c >= 0x100 || MB_BYTE2LEN(vpeekc()) > 1))
> {
> @@ -1091,6 +1092,7 @@
> else
> ca.ncharC2 = c;
> }
> + ++no_mapping;
> #endif
> }
> --no_mapping;
Thanks for the clear example. It works for any multi-byte character,
e.g. using á instead of <M-d>.
Unfortunately, after the fix now we have the opposite problem: If a
composing character is mapped, the mapping should not apply here.
However, that's much more unlikely to happen. Fixing it properly is
going to be very compliated.
--
CART DRIVER: Bring out your dead!
We follow the cart through a wretched, impoverished plague-ridden village.
A few starved mongrels run about in the mud scavenging. In the open
doorway of one house perhaps we jug glimpse a pair of legs dangling from
the ceiling. In another doorway an OLD WOMAN is beating a cat against a
wall rather like one does with a mat. The cart passes round a dead donkey
or cow in the mud. And a MAN tied to a cart is being hammered to death by
four NUNS with huge mallets.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// 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.