osyo-manga/vim-over

Unicode combining characters causes an index error

Opened this issue · 3 comments

I get a "list index out of range" when accessing the vim-over command line history whenever there are unicode combining characters in the previous expression.

Error

vital-over(_over) Exception : function over#command_line[2] …, line 1 Vim(call):E684: list index out of range: 8

0040_2018-03-19_15-02

Steps to reproduce

  1. Start vim with an empty buffer
  2. Open vim-over command line
  3. Enter some text with combining characters into the vim-over command line. E.g. %s,ö,ö, (i.e. replace {LATIN SMALL LETTER O} + {COMBINING DIAERESIS} with {LATIN SMALL LETTER O WITH DIAERESIS}
  4. <CR> to complete
  5. Open vim-over command line again
  6. Move up to access previous expression

Version

vim-over

$ git show -q
commit 5a255426ba426c82f859c02447e63e852e07ecf4
Author: manga_osyo <manga.osyo@gmail.com>
Date:   Tue Nov 7 04:14:16 2017 +0900

    Fix g:over#command_line#enable_import_commandline_map.

vim

$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Feb 28 2018 15:22:13)
Included patches: 1-1553
Modified by <bugzilla@redhat.com>
Compiled by <bugzilla@redhat.com>
Huge version without GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    -tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          -toolbar
+cindent           +insert_expand     +path_extra        +user_commands
-clientserver      +job               +perl/dyn          +vertsplit
-clipboard         +jumplist          +persistent_undo   +virtualedit
+cmdline_compl     +keymap            +postscript        +visual
+cmdline_hist      +lambda            +printer           +visualextra
+cmdline_info      +langmap           +profile           +viminfo
+comments          +libcall           +python/dyn        +vreplace
+conceal           +linebreak         +python3/dyn       +wildignore
+cryptv            +lispindent        +quickfix          +wildmenu
+cscope            +listcmds          +reltime           +windows
+cursorbind        +localmap          +rightleft         +writebackup
+cursorshape       +lua/dyn           +ruby/dyn          -X11
+dialog_con        +menu              +scrollbind        -xfontset
+diff              +mksession         +signs             -xim
+digraphs          +modify_fname      +smartindent       -xpm
-dnd               +mouse             +startuptime       -xsmp
-ebcdic            -mouseshape        +statusline        -xterm_clipboard
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_save
+eval              +mouse_gpm         +syntax            
+ex_extra          -mouse_jsbterm     +tag_binary        
+extra_search      +mouse_netterm     +tag_old_static    
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/etc"
 f-b for $VIMRUNTIME: "/usr/share/vim/vim80"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -O2 -g -pipe -Wall -Werror=format-security -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/python3.6m -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -L. -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,--enable-new-dtags -Wl,-z,relro   -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -L/usr/local/lib -Wl,--as-needed -o vim        -lm -lnsl  -lselinux   -lncurses -lacl -lattr -lgpm -ldl   -Wl,--enable-new-dtags -Wl,-z,relro  -Wl,-z,relro  -fstack-protector-strong -L/usr/local/lib  -L/usr/lib64/perl5/CORE -lperl -lpthread -lresolv -lnsl -ldl -lm -lcrypt -lutil -lc        

Thanks for issues.
I fixed it.
Please update plugin.

The last commit gives me some issues loading the plugin properly. Seems vital#of doesn't get autoloaded, which causes a chain of other issues…

When running :OverCommandLine:

Error detected while processing function over#vital:                                                                                                                                        
line    7:
E117: Unknown function: vital#of
E15: Invalid expression: vital#of("over")
line    9:
E121: Undefined variable: s:V
E15: Invalid expression: s:V
Error detected while processing /home/username/.vim/bundle/vim-over/autoload/over/command_line.vim:
line   13:
E117: Unknown function: import
E15: Invalid expression: s:V.import("Coaster.Highlight")
line   14:
E117: Unknown function: import
E15: Invalid expression: s:V.import("Over.Commandline.Modules")
Error detected while processing function <SNR>166_cmdline[4]..over#vital:
line    7:
E117: Unknown function: vital#of
E15: Invalid expression: vital#of("over")
line    9:
E121: Undefined variable: s:V
E15: Invalid expression: s:V
Error detected while processing function <SNR>166_cmdline:
line    4:
E117: Unknown function: import
E15: Invalid expression: over#vital().import("Over.Commandline")
line    5:
E121: Undefined variable: s:_cmdline
E15: Invalid expression: s:_cmdline
Error detected while processing /home/username/.vim/bundle/vim-over/autoload/over/command_line.vim:
line   27:
E117: Unknown function: make_standard
E15: Invalid expression: s:cmdline().make_standard("")
line   28:
E121: Undefined variable: s:main
line   29:
E121: Undefined variable: s:main
line   30:
E121: Undefined variable: s:main
line   31:
E121: Undefined variable: s:main
line   62:
E121: Undefined variable: s:main
line   81:
E121: Undefined variable: s:main
line   85:
E133: :return not inside a function
line   86:
E193: :endfunction not inside a function
line  114:
E121: Undefined variable: s:main
line  153:
E127: Cannot redefine function over#command_line#start: It is in use
Error detected while processing function over#command_line[2]..over#command_line#start[3]..over#command_line#get:
line    1:
E121: Undefined variable: s:main
E15: Invalid expression: s:main
Error detected while processing function over#command_line[2]..over#command_line#start:
line    3:
E117: Unknown function: get_module
E116: Invalid arguments for function empty(over#command_line#get().get_module("Digraphs"))
E15: Invalid expression: g:over#command_line#enable_Digraphs^I&& empty(over#command_line#get().get_module("Digraphs"))
line   13:
E121: Undefined variable: s:main
line   19:
E121: Undefined variable: s:main
line   23:
E121: Undefined variable: s:main
line   24:
E121: Undefined variable: s:main
E15: Invalid expression: s:main.start(a:input)
line   25:
E121: Undefined variable: exit_code
E15: Invalid expression: exit_code == 1

oops, sorry.
I fixed it.