sunnyranjan12 / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

Multibyte in langmap (lhs) gets not handled properly in mapping #297

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. :set langmap=öc
2. :map col :set list!
3. Press: öol

What is the expected output? What do you see instead?

The list setting should have been toggled, but the mapping gets aborted after 
"öo".

Using "öap" to change a paragraph works.

This is related to the langmap lhs character being multibyte, it works with 
"langmap=dc".

What version of the product are you using? On what operating system?

7.4.552

Please provide any additional information below.

It's probably some issue where multibyte characters in mappings are not handled 
properly in `do_map` or somewhere similar.

It might be related to this code:

                if (mp->m_keys[0] == c1
                    && (mp->m_mode & local_State)
                    && ((mp->m_mode & LANGMAP) == 0
                    || typebuf.tb_maplen == 0)
                                    )
                {
    #ifdef FEAT_LANGMAP
                int nomap = nolmaplen;
                int c2;
    #endif
                /* find the match length of this mapping */
                for (mlen = 1; mlen < typebuf.tb_len; ++mlen)
                {
    #ifdef FEAT_LANGMAP
                    c2 = typebuf.tb_buf[typebuf.tb_off + mlen];
                    if (nomap > 0)
                    --nomap;
                    else if (c2 == K_SPECIAL)
                    nomap = 2;
                    else
                    LANGMAP_ADJUST(c2, TRUE);
                    if (mp->m_keys[mlen] != c2)
    #else
                    if (mp->m_keys[mlen] !=
                    typebuf.tb_buf[typebuf.tb_off + mlen])
    #endif
                    break;
                }

Original issue reported on code.google.com by dhahler@gmail.com on 14 Dec 2014 at 7:09