Loading ...
Sorry, an error occurred while loading the content.

Bug? Win32 GUI keyboard input: silent change between V6.2 and V6.3

Expand Messages
  • Alexandru Panoiu
    Bug? Win32 GUI keyboard input: silent change between V6.2 and V6.3 In version 6.2 and before: All characters input from the keyboard were accessible for
    Message 1 of 2 , Nov 30, 2005
    • 0 Attachment
      Bug? Win32 GUI keyboard input: silent change between V6.2 and V6.3

      In version 6.2 and before: All characters input from the keyboard
      were accessible for mapping.
      In version 6.3 and 6.4: Gvim behaves as if an implicit call to
      iconv() is made before the mapping machinery gets to look at the
      characters input.

      I am using Vim on Windows XP. It seems that keyboard handling has
      changed between Vim 6.2 and Vim 6.3. The change seems to affect
      only gvim.exe; the console version vim.exe is not affected.

      Test scenario:

      1. Windows is set to U.S. English locale, keyboard is U.S. English.
      2. Run gvim:
      C> gvim -u nul
      3. Confirm that &encoding is latin1:
      :echo &encoding
      latin1
      4. Go to insert mode and press Alt+Q.
      5. Vim inserts character 0xF1 (latin small letter n with tilde).
      The glyph displayed may be different, depending on the font
      selected by Vim when &gfn is empty.
      6. Press <Esc> to leave insert mode. Confirm the character code:
      :echo char2nr(getline('.'))
      241
      7. Set &encoding to cp1250:
      :set encoding=cp1250
      :echo &encoding
      cp1250
      8. Go to insert mode again and press Alt+Q.
      9. Observe that Vim inserts character 0x6E (latin small letter n).

      At step 8 Gvim version 6.2 and before would insert a byte with
      value 0xF1 for any 8-bit &encoding.

      Gvim versions 6.3 and 6.4 behaves as if between the character
      sent by the keyboard and the character recognized by the editor
      there is an implicit call to iconv(). This did not happen in
      version 6.2 and before.

      The effect of this change is that some key combinations are not
      mappable if the character code produced is not representable in
      the current encoding. For example, if &encoding is cp1250, Alt+Q
      is not mappable, because U+00F1 is not representable in code page
      1250 and gets silently translated to U+006E before the mapping
      machinery is invoked.

      Tested versions:

      VIM - Vi IMproved 6.2 (2003 Jun 1, compiled Jun 1 2003 16:33:11)
      MS-Windows 32 bit GUI version
      Compiled by Administrator@KIBAALE
      Big version with GUI. Features included (+) or not (-):
      +arabic +autocmd -balloon_eval +browse ++builtin_terms
      +byte_offset +cindent +clientserver +clipboard +cmdline_compl
      +cmdline_hist +cmdline_info +comments +cryptv -cscope +dialog_gui
      +diff +digraphs -dnd -ebcdic +emacs_tags +eval +ex_extra
      +extra_search +farsi +file_in_path +find_in_path +folding -footer
      +gettext/dyn -hangul_input +iconv/dyn +insert_expand +jumplist
      +keymap +langmap +libcall +linebreak +lispindent +listcmds
      +localmap +menu +mksession +modify_fname +mouse +mouseshape
      +multi_byte +multi_lang -netbeans_intg -ole -osfiletype
      +path_extra -perl -postscript +printer -python +quickfix
      +rightleft -ruby +scrollbind +signs +smartindent -sniff
      +statusline -sun_workshop +syntax +tag_binary +tag_old_static
      -tag_any_white -tcl -tgetent -termresponse +textobjects +title
      +toolbar +user_commands +vertsplit +virtualedit +visual
      +visualextra +viminfo +vreplace +wildignore +wildmenu +windows
      +writebackup -xfontset -xim -xterm_save
      system vimrc file: "$VIM\vimrc"
      user vimrc file: "$HOME\_vimrc"
      2nd user vimrc file: "$VIM\_vimrc"
      user exrc file: "$HOME\_exrc"
      2nd user exrc file: "$VIM\_exrc"
      system gvimrc file: "$VIM\gvimrc"
      user gvimrc file: "$HOME\_gvimrc"
      2nd user gvimrc file: "$VIM\_gvimrc"
      system menu file: "$VIMRUNTIME\menu.vim"
      Compilation: cl -c /W3 /nologo -DWIN32 -D_WIN32 -I. -Iproto
      -DHAVE_PATHDEF -DWI N32 -DWINVER=0x400 -D_WIN32_WINNT=0x400 /Ox
      -DNDEBUG /Zi -DDYNAMIC_ICONV - DDYNAMIC_GETTEXT -DFEAT_BIG
      Linking: link /RELEASE /nologo /subsystem:console /incremental:no
      /nodefaultlib: libc advapi32.lib shell32.lib gdi32.lib
      comdlg32.lib ole32.lib uuid.lib libc.li b user32.lib /PDB:.\ObjC/

      VIM - Vi IMproved 6.3 (2004 June 7, compiled Jun 7 2004 14:16:38)
      MS-Windows 32 bit GUI version
      Compiled by Bram@KIBAALE
      Big version with GUI. Features included (+) or not (-):
      +arabic +autocmd +balloon_eval +browse ++builtin_terms
      +byte_offset +cindent +clientserver +clipboard +cmdline_compl
      +cmdline_hist +cmdline_info +comments +cryptv +cscope
      +dialog_con_gui +diff +digraphs -dnd -ebcdic +emacs_tags +eval
      +ex_extra +extra_search +farsi +file_in_path +find_in_path
      +folding -footer +gettext/dyn -hangul_input +iconv/dyn
      +insert_expand +jumplist +keymap +langmap +libcall +linebreak
      +lispindent +listcmds +localmap +menu +mksession +modify_fname
      +mouse +mouseshape +multi_byte +multi_lang +netbeans_intg -ole
      -osfiletype +path_extra -perl -postscript +printer -python
      +quickfix +rightleft -ruby +scrollbind +signs +smartindent -sniff
      +statusline -sun_workshop +syntax +tag_binary +tag_old_static
      -tag_any_white -tcl -tgetent -termresponse +textobjects +title
      +toolbar +user_commands +vertsplit +virtualedit +visual
      +visualextra +viminfo +vreplace +wildignore +wildmenu +windows
      +writebackup -xfontset -xim -xterm_save -xpm_w32
      system vimrc file: "$VIM\vimrc"
      user vimrc file: "$HOME\_vimrc"
      2nd user vimrc file: "$VIM\_vimrc"
      user exrc file: "$HOME\_exrc"
      2nd user exrc file: "$VIM\_exrc"
      system gvimrc file: "$VIM\gvimrc"
      user gvimrc file: "$HOME\_gvimrc"
      2nd user gvimrc file: "$VIM\_gvimrc"
      system menu file: "$VIMRUNTIME\menu.vim"
      Compilation: cl -c /W3 /nologo -DWIN32 -D_WIN32 -I. -Iproto
      -DHAVE_PATHDEF -DWI N32 -DFEAT_CSCOPE -DWINVER=0x0400
      -D_WIN32_WINNT=0x0400 /Ox -DNDEBUG /Zi -DDYNAMIC_ICONV
      -DDYNAMIC_GETTEXT -DFEAT_BIG
      Linking: link /RELEASE /nologo /subsystem:console /incremental:no
      /nodefaultlib: libc advapi32.lib shell32.lib gdi32.lib
      comdlg32.lib ole32.lib uuid.lib libc.li b user32.lib /PDB:.\ObjC/
    • Bram Moolenaar
      ... This is actually a bugfix. Vim converts tye input from your system encoding to encoding . Otherwise typing normal text would not result in the right
      Message 2 of 2 , Nov 30, 2005
      • 0 Attachment
        Alexandru Panoiu wrote:

        > Bug? Win32 GUI keyboard input: silent change between V6.2 and V6.3
        >
        > In version 6.2 and before: All characters input from the keyboard
        > were accessible for mapping.
        > In version 6.3 and 6.4: Gvim behaves as if an implicit call to
        > iconv() is made before the mapping machinery gets to look at the
        > characters input.
        >
        > I am using Vim on Windows XP. It seems that keyboard handling has
        > changed between Vim 6.2 and Vim 6.3. The change seems to affect
        > only gvim.exe; the console version vim.exe is not affected.

        This is actually a bugfix. Vim converts tye input from your system
        encoding to 'encoding'. Otherwise typing normal text would not result
        in the right characters. In Vim 6.2 this was not working properly. One
        of the many patches for Vim 6.2 fixed it.

        If you change 'encoding' you need to define mappings again. It's
        unavoidable that changing 'encoding' has side effects. That's why you
        should set it early in the startup and not change it.

        --
        hundred-and-one symptoms of being an internet addict:
        265. Your reason for not staying in touch with family is that
        they do not have e-mail addresses.

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ download, build and distribute -- http://www.A-A-P.org ///
        \\\ help me help AIDS victims -- http://www.ICCF.nl ///
      Your message has been successfully submitted and would be delivered to recipients shortly.