In the attached script vim prints sequence of ten `27' (that is character 
number 
of escape) and a `10', while it is supposed to print

99
104
97
114
115
5

(this is ASCII values of characters in string `chars' and a number of symbols).
Test command:
    vim -u NONE -c 'so test-normalesc.vim' -c 'messages' -c 'qa!'


PS: It looks like it is impossible to write tests for vim plugins using 
vimscript, so I will now have to switch to something like pexpect or just stop 
writing them.
set nocompatible
function! GetChars()
    let i=0
    sleep 1
    while getchar(1)!=0 && i<10
        echom getchar()
        let i+=1
    endwhile
    echom i
    return ""
endfunction
noremap <expr> TEST GetChars()
normal TESTchars

Attachment: signature.asc
Description: This is a digitally signed message part.

Raspunde prin e-mail lui