Hi Bram, 2015/2/19(Thu) 7:09:40 UTC+9 Bram Moolenaar: > Hirohito Higashi wrote: > > [...] > > > > > > And ... > > > > > I found specification inconsistency between 'complete()' and > > > > > 'backspace' option. > > > > > > > > > > How to reproduce: > > > > > 1. cat test.vim > > > > > inoremap <F5> <C-R>=ListMonths()<CR> > > > > > > > > > > func! ListMonths() > > > > > call complete(1, ['One', 'Three']) > > > > > return '' > > > > > endfunc > > > > > > > > > > 2. vim -N -u test.vim > > > > > > > > > > 3. Enter insert-mode and input 'ab' and leave insert-mode. > > > > > iab<Esc> > > > > > > > > > > 4. Reenter insert-mode and use 'complete()' > > > > > a<F5> > > > > > > > > > > 5. Delete two characters. > > > > > <C-H><C-H> > > > > > > > > > > What happen. > > > > > - '4.' Edit start columns 3, but 'complete()' starts 1 (by 1st > > > > > argument). > > > > > - '5.' Can't delete column 1 and 2 > > > > > 'backspace' option not contain "start", So vim can not deleted this. > > > > > > > > > > I think this is specification inconsistency. > > > > > How Let's fix? > > > > > (a) Occurred an error when 'complete()' first argument is can not be > > > > > deleted by under the influence of the 'backspace' option. > > > > > > > > > > (b) Adjust the first argument value implicitly in f_complete(). (In > > > > > this case, Ajust 3) > > > > > > > > > > (c) Between 'complete()' is functioning to ignore the 'backspace' > > > > > option. > > > > > > > > > > I would write the patch when you are determined. > > > > > > > > Bram, Please decide a specification. > > > > > > The 'backspace' option should probably be ignored in this situation, > > > since the code says to change those characters. 'backspace' is really > > > to make Vim backwards compatible with Vi, for those users who prefer it > > > that way. I don't think it should apply to Insert mode completion. > > > > Thanks for the reply. > > I was convinced to your opinion. But thinking has changed to one that is by > > analyzing the source code in order to write a patch. > > Because, The completion mode has been finished(*1) before function ins_bs() > > is called When I first press the <C-H> key at reproduce step '5.'. > > > > *1: ins_compl_active() returns 0 and ctrl_x_mode is 0. > > > > Therefore, it is impossible to determination of whether a complementing in > > ins_bs(). > > > > So, the specification I'd be in (a) or (b). > > What do you think? > > If I remember correctly, ins_bs() is used also for inserting the > completed string to make redo work properly. It should be possible to > make ins_bs() behave like 'backspace' is set. Either by passing an > argument or temporarily setting the option. > > Or perhaps change the Insert start position to the column in complete(). > Not sure if that causes problems (there have been some bugs related to > changing the insert start position).
I have tried to actually implement the plan (b). There was a problem as it was said of you. Indeed You're Vim BOSS yeah! And I don't understand how to implement plan (c) that by using redo work. May I ask your implementation of plan (c)? My patch(builtin_func_complete_fix2.patch) may fixed other 'complete()' bugs. First, I want include this patch. Thank you. Best regards, Hirohito Higashi (a.k.a h_east) -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
