Patch 7.3.289

89 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 28, 2011, 10:02:46 AM8/28/11
to vim...@googlegroups.com

Patch 7.3.289
Problem: Complete function isn't called when the leader changed.
Solution: Call ins_compl_restart() when the leader changed. (Taro Muraoka)
Files: src/edit.c


*** ../vim-7.3.288/src/edit.c 2011-05-19 17:25:36.000000000 +0200
--- src/edit.c 2011-08-28 15:53:47.000000000 +0200
***************
*** 3367,3372 ****
--- 3367,3381 ----
ins_bytes(compl_leader + ins_compl_len());
compl_used_match = FALSE;

+ #ifdef FEAT_COMPL_FUNC
+ /*
+ * To call eval 'completefunc' when leader is changed, restart completion
+ * every time.
+ */
+ if (ctrl_x_mode == CTRL_X_FUNCTION || ctrl_x_mode == CTRL_X_OMNI)
+ ins_compl_restart();
+ #endif
+
if (compl_started)
ins_compl_set_original_text(compl_leader);
else
*** ../vim-7.3.288/src/version.c 2011-08-28 16:00:14.000000000 +0200
--- src/version.c 2011-08-28 16:01:22.000000000 +0200
***************
*** 711,712 ****
--- 711,714 ----
{ /* Add new patch number below this line */
+ /**/
+ 289,
/**/

--
THEOREM: VI is perfect.
PROOF: VI in roman numerals is 6. The natural numbers < 6 which divide 6 are
1, 2, and 3. 1+2+3 = 6. So 6 is a perfect number. Therefore, VI is perfect.
QED
-- Arthur Tateishi

/// 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 ///

驼峰

unread,
Sep 5, 2011, 7:29:36 AM9/5/11
to vim_dev
with this patch, the snipMate plugin won't work correctly with auto
completio popup.

After applying this patch, the AutoComplPop will popup a list of
snippets for current filetype. This is a little bit annoying. So, I
have to revert to previous one.
>  /// Bram Moolenaar -- B...@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       ///

mattn

unread,
Sep 5, 2011, 12:51:32 PM9/5/11
to vim...@googlegroups.com
Hi.

I can't reproduce it.
Please show me

* version of ACP
* version of snipMate
* what the patch of ACP? only GetSnipsInCurrentScope?
* what keys did you type?

Thanks.


On Monday, September 5, 2011 8:29:36 PM UTC+9, 驼峰 wrote:
with this patch, the snipMate plugin won't work correctly with auto
completio popup.

After applying this patch, the AutoComplPop will popup a list of
snippets for current filetype. This is a little bit annoying. So, I
have to revert to previous one.

>  /// Bram Moolenaar -- B....@Moolenaar.net --http://www.Moolenaar.net  \\\

驼峰

unread,
Sep 5, 2011, 9:13:21 PM9/5/11
to vim_dev
patch 289.

Repro steps:
1. install acp and snipMate.
2. open vim and new a buffer.
3. "file aa.cpp"
4. type "Ex" at the beginning of line.

all the snippets of "C" file will be shown.

驼峰

unread,
Sep 5, 2011, 9:20:29 PM9/5/11
to vim_dev
BTW, the environments:

acp version: 2.14.1
snipMate version: 0.83
only change snipMate.vim to include GetSnipsInCurrentScope.

mattn

unread,
Sep 5, 2011, 9:20:58 PM9/5/11
to vim...@googlegroups.com
What is your point?

* "Showing all snippets" is wrong?
* or else?


On Tuesday, September 6, 2011 10:13:21 AM UTC+9, 驼峰 wrote:
patch 289.

Repro steps:
1. install acp and snipMate.
2. open vim and new a buffer.
3. "file aa.cpp"
4. type "Ex" at the beginning of line.

all the snippets of "C" file will be shown.

驼峰

unread,
Sep 5, 2011, 9:23:18 PM9/5/11
to vim_dev
here is some sample of c.snippets.

# main()
snippet main
int main(int argc, const char *argv[])
{
${1}
return 0;
}
snippet mainn
int main(void)
{
${1}
return 0;
}
# #include <...>
snippet inc
#include <${1:stdio}.h>${2}
# #include "..."
snippet Inc
#include "${1:`Filename("$1.h")`}"${2}
# #ifndef ... #define ... #endif
snippet Def
#ifndef $1
#define ${1:SYMBOL} ${2:value}
#endif${3}
snippet def
#define
snippet ifdef
#ifdef ${1:FOO}
${2:#define }
#endif
snippet #if
#if ${1:FOO}
${2}
#endif
# Header Include-Guard
snippet once
#ifndef ${1:`toupper(Filename('__$1_H__', 'UNTITLED_H'))`}
#define $1

${2}

#endif // $1

If I input "Ex", the following shortcut for snippets will be shown.
main
mainn
inc
Inc
Def
def
ifdef
...

mattn

unread,
Sep 5, 2011, 9:34:31 PM9/5/11
to vim...@googlegroups.com
Sorry, I'm not export of snippets.vim, so please explain "WHAT IS WRONG".
What should be shown?
What is correct behavior?
And what is wrong?

驼峰

unread,
Sep 5, 2011, 9:47:50 PM9/5/11
to vim_dev
sorry for the confusion.

When I typing "Ex", acp will show all the "snipMate triggers" for
current file type. This is not expected. The expected behavior is: acp
should only show popup for content included in current buffer instead
of all other "triggers" for current file type.

Is it clear?





mattn

unread,
Sep 5, 2011, 10:38:29 PM9/5/11
to vim...@googlegroups.com
Just, I could reproduce it. ;)
Thanks.

Vim did not work correctly to call completefunc since patch7.3.298 .
If leading characters are changed after showing popup, completefunc should be called in fact.
But completefunc hadn't called.
This is bug of vim that Muraoka pointed.

Thus, acp just need to check wheter second argument 'a:base' is empty or not.
(Sorry, I'm not sure)

diff -r 13fe3d806464 autoload/acp.vim
--- a/autoload/acp.vim Thu Sep 30 18:22:27 2010 +0900
+++ b/autoload/acp.vim Tue Sep 06 11:35:33 2011 +0900
@@ -166,6 +166,9 @@
     let s:posSnipmateCompletion = len(matchstr(s:getCurrentText(), '.*\U'))
     return s:posSnipmateCompletion
   endif
+  if a:base == ''
+    return []
+  endif
   let lenBase = len(a:base)
   let items = filter(GetSnipsInCurrentScope(),
         \            'strpart(v:key, 0, lenBase) ==? a:base')

Reply all
Reply to author
Forward
0 new messages