lifepillar / vim-mucomplete

Chained completion that works the way you want!
MIT License
913 stars 18 forks source link

Cursor Jumping when using spel #22

Closed tjharman closed 8 years ago

tjharman commented 8 years ago

For bug reports only, please provide the following details:

let g:mucomplete#chains = {
      \ 'default' : ['file', 'omni', 'keyn', 'dict', 'spel']
      \ }
let g:mucomplete#chains = {
      \ 'default' : ['file', 'omni', 'keyn', 'dict', 'spel']
      \ }

If your problem has to do with specific completion methods, please provide the output of the relevant settings among the following:

spellang=en_au
complete+=k
set spell

If I enable spelling, with the options set above, I can't type: ta"ing

Instead what happens is I type ta"in and then for some reason (the message at the bottom says "Back at the original") the cursor jumps back to ta|"in then I press g. So I end up with tag"in

Also, if I have the following text:

some "Ta"ing occurs and then it's the same thing over and over. My name is water

If I try to backspace in insert mode from water, once water is deleted the cursor will jump back to "Ta"ing|

I guess this is actually some sort of vim behavior I am triggering?

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Sep 12 2016 18:25:27)
MS-Windows 32-bit GUI version with OLE support
Included patches: 1-2
Compiled by mool@tororo
Huge version with GUI.  Features included (+) or not (-):
+acl                +clipboard          +dialog_con_gui     +farsi              +job                -lua                +num64              +python3/dyn        -sun_workshop       +timers             +wildignore
+arabic             +cmdline_compl      +diff               +file_in_path       +jumplist           +menu               +ole                +quickfix           +syntax             +title              +wildmenu
+autocmd            +cmdline_hist       +digraphs           +find_in_path       +keymap             +mksession          +packages           +reltime            +tag_binary         +toolbar            +windows
+balloon_eval       +cmdline_info       +directx            +float              +lambda             +modify_fname       +path_extra         +rightleft          +tag_old_static     +user_commands      +writebackup
+browse             +comments           -dnd                +folding            +langmap            +mouse              +perl/dyn           +ruby/dyn           -tag_any_white      +vertsplit          -xfontset
++builtin_terms     +conceal            -ebcdic             -footer             +libcall            +mouseshape         +persistent_undo    +scrollbind         +tcl/dyn            +virtualedit        -xim
+byte_offset        +cryptv             +emacs_tags         +gettext/dyn        +linebreak          +multi_byte_ime/dyn -postscript         +signs              -termguicolors      +visual             +xpm_w32
+channel            +cscope             +eval               -hangul_input       +lispindent         +multi_lang         +printer            +smartindent        -tgetent            +visualextra        -xterm_save
+cindent            +cursorbind         +ex_extra           +iconv/dyn          +listcmds           -mzscheme           +profile            +startuptime        -termresponse       +viminfo            
+clientserver       +cursorshape        +extra_search       +insert_expand      +localmap           +netbeans_intg      +python/dyn         +statusline         +textobjects        +vreplace           
   system vimrc file: "$VIM\vimrc"
     user vimrc file: "$HOME\_vimrc"
 2nd user vimrc file: "$HOME\vimfiles\vimrc"
 3rd 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: "$HOME\vimfiles\gvimrc"
3rd user gvimrc file: "$VIM\_gvimrc"
       defaults file: "$VIMRUNTIME\defaults.vim"
    system menu file: "$VIMRUNTIME\menu.vim"
Compilation: cl -c /W3 /nologo  -I. -Iproto -DHAVE_PATHDEF -DWIN32  -DFEAT_CSCOPE -DFEAT_NETBEANS_INTG -DFEAT_JOB_CHANNEL   -DFEAT_XPM_W32   -DWINVER=0x0501 -D_WIN32_WINNT=0x0501  /Fo.\ObjGXOLYHTRi386/ /Ox /GL -DNDEBUG  /Zl /MT -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_GUI_W32 -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl86.dll\" -DDYNAMIC_TCL_VER=\"8.6\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python35.dll\" -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl524.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=22 -DDYNAMIC_RUBY_DLL=\"msvcrt-ruby220.dll\" -DFEAT_HUGE /Fd.\ObjGXOLYHTRi386/ /Zi
Linking: link /RELEASE /nologo /subsystem:windows /LTCG:STATUS oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib  comdlg32.lib ole32.lib uuid.lib /machine:i386 gdi32.lib version.lib   winspool.lib comctl32.lib advapi32.lib shell32.lib  /machine:i386 /nodefaultlib libcmt.lib oleaut32.lib user32.lib     /nodefaultlib:python27.lib /nodefaultlib:python35.lib   "E:\tcl\lib\tclstub86.lib" WSock32.lib xpm\x86\lib\libXpm.lib /PDB:gvim.pdb -debug
lifepillar commented 8 years ago

Instead what happens is I type ta"in and then for some reason (the message at the bottom says "Back at the original") the cursor jumps back to ta|"in then I press g

That's how spelling suggestions are designed to work. From :help compl-spelling:

A word before or at the cursor is located and correctly spelled words are suggested to replace it. If there is a badly spelled word in the line, before or under the cursor, the cursor is moved to after it.

tjharman commented 8 years ago

Ahhh right, of course. This is me misunderstanding vim's definition of a word. Sorry for the bogus bug report.

tjharman commented 8 years ago

Sorry, that explains the first part of the bug report, but does that explain the second (the cursor jumping around a long way on backspace)?

lifepillar commented 8 years ago

When you start backspacing, autocompletion is triggered once and that causes spelling suggestions to be shown for wate. Going on backspacing, nothing special happens as long as the pop-up menu stays open. When you reach the space, the pop-up menu closes because there are no matches before the cursor. When you backspace once more, you get…is in front of the cursor and autocompletion fires again. Since all the methods before 'spel' in your chain fail to return any result for is, eventually the 'spel' method is attempted. That is what causes the jump, as per the behaviour described in the manual. If there was another occurrence of is in the text, keyword completion would take precedence and the cursor wouldn't jump.

My recommendation is not to use 'spel' together with automatic completion. I wish there was an option in Vim to force spelling suggestions only for the current word, but unfortunately there isn't (as far as I know).

lifepillar commented 8 years ago

To see that it's Vim's default behaviour, turn off autocompletion and press <c-x>s when the cursor is just after is. You will see it jump to "Ta"ing.

tjharman commented 8 years ago

Thank you for the concise explanation. It is appreciated and again I apologise for wasting your time.

lifepillar commented 8 years ago

No worry. Feel free to open other issues if you need to provide more feedback!

lifepillar commented 7 years ago

@tjharman The current master has a new 'uspl' completion method, which works like 'spel', but acts only on the word immediately before the cursor. That should resolve the issue you were having.

tjharman commented 7 years ago

Fantastic! Thank you! I'll give it a try shortly.