Patch 7.3.598

286 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 10, 2012, 11:15:12 AM7/10/12
to vim...@googlegroups.com

Patch 7.3.598
Problem: Cannot act upon end of completion. (Taro Muraoka)
Solution: Add an autocommand event that is triggered when completion has
finished. (Idea by Florian Klein)
Files: src/edit.c, src/fileio.c, src/vim.h


*** ../vim-7.3.597/src/edit.c 2012-07-06 13:36:36.000000000 +0200
--- src/edit.c 2012-07-10 17:02:37.000000000 +0200
***************
*** 3824,3829 ****
--- 3824,3834 ----
if (want_cindent && in_cinkeys(KEY_COMPLETE, ' ', inindent(0)))
do_c_expr_indent();
#endif
+ #ifdef FEAT_AUTOCMD
+ /* Trigger the CompleteDone event to give scripts a chance to act
+ * upon the completion. */
+ apply_autocmds(EVENT_COMPLETEDONE, NULL, NULL, FALSE, curbuf);
+ #endif
}
}

*** ../vim-7.3.597/src/fileio.c 2012-06-13 14:28:16.000000000 +0200
--- src/fileio.c 2012-07-10 17:05:51.000000000 +0200
***************
*** 7643,7648 ****
--- 7643,7649 ----
{"CmdwinEnter", EVENT_CMDWINENTER},
{"CmdwinLeave", EVENT_CMDWINLEAVE},
{"ColorScheme", EVENT_COLORSCHEME},
+ {"CompleteDone", EVENT_COMPLETEDONE},
{"CursorHold", EVENT_CURSORHOLD},
{"CursorHoldI", EVENT_CURSORHOLDI},
{"CursorMoved", EVENT_CURSORMOVED},
*** ../vim-7.3.597/src/vim.h 2012-07-10 13:41:09.000000000 +0200
--- src/vim.h 2012-07-10 17:06:24.000000000 +0200
***************
*** 1241,1246 ****
--- 1241,1247 ----
EVENT_CMDWINENTER, /* after entering the cmdline window */
EVENT_CMDWINLEAVE, /* before leaving the cmdline window */
EVENT_COLORSCHEME, /* after loading a colorscheme */
+ EVENT_COMPLETEDONE, /* after finishing insert complete */
EVENT_FILEAPPENDPOST, /* after appending to a file */
EVENT_FILEAPPENDPRE, /* before appending to a file */
EVENT_FILEAPPENDCMD, /* append to a file using command */
*** ../vim-7.3.597/src/version.c 2012-07-10 16:49:08.000000000 +0200
--- src/version.c 2012-07-10 17:08:41.000000000 +0200
***************
*** 716,717 ****
--- 716,719 ----
{ /* Add new patch number below this line */
+ /**/
+ 598,
/**/

--
Laughing helps. It's like jogging on the inside.

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

Bram Moolenaar

unread,
Jul 10, 2012, 12:03:21 PM7/10/12
to MURAOKA Taro, vim...@googlegroups.com

I wrote:

> Patch 7.3.598
> Problem: Cannot act upon end of completion. (Taro Muraoka)
> Solution: Add an autocommand event that is triggered when completion has
> finished. (Idea by Florian Klein)
> Files: src/edit.c, src/fileio.c, src/vim.h

Let me know if this is not sufficient for your purposes. We could pass
some information to the autocommand.

--
hundred-and-one symptoms of being an internet addict:
107. When using your phone you forget that you don't have to use your
keyboard.

MURAOKA Taro

unread,
Jul 10, 2012, 6:50:47 PM7/10/12
to Bram Moolenaar, vim...@googlegroups.com
Thank you!

Let't me investigate it.


2012/7/11 Bram Moolenaar <Br...@moolenaar.net>:
--
MURAOKA Taro <koron....@gmail.com>

Taro MURAOKA

unread,
Jul 10, 2012, 10:40:43 PM7/10/12
to vim...@googlegroups.com
2012年7月11日水曜日 1時03分21秒 UTC+9 Bram Moolenaar:
> I wrote:
>
> &gt; Patch 7.3.598
> &gt; Problem: Cannot act upon end of completion. (Taro Muraoka)
> &gt; Solution: Add an autocommand event that is triggered when completion has
> &gt; finished. (Idea by Florian Klein)
> &gt; Files: src/edit.c, src/fileio.c, src/vim.h
>
> Let me know if this is not sufficient for your purposes. We could pass
> some information to the autocommand.
>
> --
> hundred-and-one symptoms of being an internet addict:
> 107. When using your phone you forget that you don&#39;t have to use your
> keyboard.
>
> /// 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 ///


Bram wrote:
> We could pass some information to the autocommand.


I finished to investigation, and realized two items are required.

1. Which a word did user selected at completion. (MUST)
2. a:base string which used to determine those candidates. (NICE TO HAVE)

2 is optional, although it may be better for complete functions authors.


Best regards.

mattn

unread,
Jul 10, 2012, 11:07:30 PM7/10/12
to vim...@googlegroups.com
> Bram wrote:
> &gt; We could pass some information to the autocommand.
>
>
> I finished to investigation, and realized two items are required.
>
> 1. Which a word did user selected at completion. (MUST)
> 2. a:base string which used to determine those candidates. (NICE TO HAVE)
>
> 2 is optional, although it may be better for complete functions authors.
>
>
> Best regards.

3. What kind of completion. tag? omnifunc? or else. (MUST)

Xavier Deguillard

unread,
Jan 23, 2013, 1:15:51 AM1/23/13
to vim...@googlegroups.com
On Thu, Dec 27, 2012 at 06:06:05AM -0800, Alexandru Tică wrote:
> 4. the index number of the selected item from the completion list. Having this additional information would be very useful in scenarios like the one posted on: http://stackoverflow.com/questions/14053720/get-selected-item-from-the-completion-popup-menu
>

Even better than the number of the select item: the whole dict as
mentionned on stackoverflow.

--
Xavier
Reply all
Reply to author
Forward
0 new messages