Skip to content

"mapset()" doesn't translate special key codes #6116

@lacygoill

Description

@lacygoill

Describe the bug

mapset() doesn't translate special key codes.

To Reproduce

Write this in /tmp/t.vim:

nno K :echom 'original mapping'<cr>
let save_map = maparg('K', 'n', 0, 1)
nunmap K
call mapset('n', 0, save_map)
call feedkeys('K')

Start Vim with this shell command:

vim -Nu NONE -S /tmp/t.vim

The command-line is populated with:

echom 'original mapping'<cr>

Notice that <cr> has not been translated into a literal carriage return.

Expected behavior

When K is pressed, the Ex command :echom 'original mapping' is executed, just like it would have been before the mapping was removed by :nunmap.

Environment

  • Vim version: 8.2 Included patches: 1-807
  • OS: Ubuntu 16.04.6 LTS
  • Terminal: XTerm(322)

Additional context

It's as if 'cpo' included the < flag which disables the recognition of special key codes.
However, that's not the issue here; 'cpo' does not contain this flag when started with -Nu NONE (-N resets 'compatible' which resets 'cpo' to aABceFs).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions