Patch 7.3.561

39 views
Skip to first unread message

Bram Moolenaar

unread,
Jun 20, 2012, 8:26:50 AM6/20/12
to vim...@googlegroups.com

Patch 7.3.561
Problem: Using refresh: always in a complete function breaks the "."
command. (Val Markovic)
Solution: Add match leader to the redo buffer. (Yasuhiro Matsumoto)
Files: src/edit.c


*** ../vim-7.3.560/src/edit.c 2012-06-13 17:28:51.000000000 +0200
--- src/edit.c 2012-06-20 14:22:23.000000000 +0200
***************
*** 3467,3476 ****
--- 3467,3480 ----
(*mb_char2bytes)(c, buf);
buf[cc] = NUL;
ins_char_bytes(buf, cc);
+ AppendToRedobuff(buf);
}
else
#endif
+ {
ins_char(c);
+ AppendCharToRedobuff(c);
+ }

/* If we didn't complete finding matches we must search again. */
if (ins_compl_need_restart())
*** ../vim-7.3.560/src/version.c 2012-06-20 14:13:02.000000000 +0200
--- src/version.c 2012-06-20 14:20:13.000000000 +0200
***************
*** 716,717 ****
--- 716,719 ----
{ /* Add new patch number below this line */
+ /**/
+ 561,
/**/

--
Microsoft is to software what McDonalds is to gourmet cooking

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Raymond Ko

unread,
Jun 20, 2012, 12:38:26 PM6/20/12
to vim...@googlegroups.com
Hello,

This patch breaks the dot register for my autocompletion plugin when 'refresh: always' is NOT set. Once the popup menu shows up, any following character is appended twice to the dot register. Although I can work around it by setting 'refresh: always' (my plugin is not dependent on this), I'm sure there is an underlying bug with the code.

Attached is a minimal test case based off of my plugin to reproduce the bug.
My results are marked on the comments of the return clause inside the completion function.
It is also available on:

https://gist.github.com/2960778

Steps to reproduce:
1. Run "C:\Program Files (x86)\Vim\vim73\gvim.exe" -u NONE -i NONE
2. :source test.vim
3. Enter insert mode
4. Type test
5. <ESC>
6. :reg(.)

My original plugin is at:
https://github.com/raymond-w-ko/omegacomplete.vim
for any interested as to why I am doing this. Note that it is still a work in progress.

test.vim

Christian Brabandt

unread,
Jun 20, 2012, 1:40:10 PM6/20/12
to vim...@googlegroups.com
Hi Raymond!

On Mi, 20 Jun 2012, Raymond Ko wrote:

> This patch breaks the dot register for my autocompletion plugin when
> 'refresh: always' is NOT set. Once the popup menu shows up, any
> following character is appended twice to the dot register. Although I
> can work around it by setting 'refresh: always' (my plugin is not
> dependent on this), I'm sure there is an underlying bug with the code.
>
> Attached is a minimal test case based off of my plugin to reproduce
> the bug. My results are marked on the comments of the return clause
> inside the completion function. It is also available on:
>
> https://gist.github.com/2960778
>
> Steps to reproduce: 1. Run "C:\Program Files (x86)\Vim\vim73\gvim.exe"
> -u NONE -i NONE 2. :source test.vim 3. Enter insert mode 4. Type test
> 5. <ESC> 6. :reg(.)
>
> My original plugin is at:
> https://github.com/raymond-w-ko/omegacomplete.vim for any interested
> as to why I am doing this. Note that it is still a work in progress.


So only add to the redo buffer, when refresh:always is set, right?

diff --git a/src/edit.c b/src/edit.c
--- a/src/edit.c
+++ b/src/edit.c
@@ -3467,13 +3467,15 @@
(*mb_char2bytes)(c, buf);
buf[cc] = NUL;
ins_char_bytes(buf, cc);
- AppendToRedobuff(buf);
+ if (compl_opt_refresh_always)
+ AppendToRedobuff(buf);
}
else
#endif
{
ins_char(c);
- AppendCharToRedobuff(c);
+ if (compl_opt_refresh_always)
+ AppendCharToRedobuff(c);
}

/* If we didn't complete finding matches we must search again. */


regards,
Christian
--

Raymond Ko

unread,
Jun 20, 2012, 2:27:05 PM6/20/12
to vim...@googlegroups.com

I just tested this on both my testcase and plugin and it seems to work fine.
Someone should probably check with Val Markovic <v...@markovic.io> to make sure
that this change does not somehow break the plugin that he is writing, even
though it seems highly unlikely that it will happen.

Thanks!

Bram Moolenaar

unread,
Jun 20, 2012, 4:56:30 PM6/20/12
to Christian Brabandt, vim...@googlegroups.com

Christian Brabandt wrote:

> On Mi, 20 Jun 2012, Raymond Ko wrote:
>
> > This patch breaks the dot register for my autocompletion plugin when
> > 'refresh: always' is NOT set. Once the popup menu shows up, any
> > following character is appended twice to the dot register. Although I
> > can work around it by setting 'refresh: always' (my plugin is not
> > dependent on this), I'm sure there is an underlying bug with the code.
> >
> > Attached is a minimal test case based off of my plugin to reproduce
> > the bug. My results are marked on the comments of the return clause
> > inside the completion function. It is also available on:
> >
> > https://gist.github.com/2960778
> >
> > Steps to reproduce: 1. Run "C:\Program Files (x86)\Vim\vim73\gvim.exe"
> > -u NONE -i NONE 2. :source test.vim 3. Enter insert mode 4. Type test
> > 5. <ESC> 6. :reg(.)
> >
> > My original plugin is at:
> > https://github.com/raymond-w-ko/omegacomplete.vim for any interested
> > as to why I am doing this. Note that it is still a work in progress.
>
>
> So only add to the redo buffer, when refresh:always is set, right?

It would be good to know why this flag needs to be checked. Add a
comment to explain. Insert mode completion has grown too complex...

--
hundred-and-one symptoms of being an internet addict:
49. You never have to deal with busy signals when calling your ISP...because
you never log off.

Val Markovic

unread,
Jun 20, 2012, 6:43:19 PM6/20/12
to vim...@googlegroups.com
On Wednesday, June 20, 2012 11:27:05 AM UTC-7, Raymond Ko wrote:
> I just tested this on both my testcase and plugin and it seems to work fine.
> Someone should probably check with Val Markovic <v...@markovic.io> to make sure
> that this change does not somehow break the plugin that he is writing, even
> though it seems highly unlikely that it will happen.

I just built the latest version of Vim from trunk that has this patch and everything works from my end.

Val

Reply all
Reply to author
Forward
0 new messages