mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
updated for version 7.3.052
Problem: When 'completefunc' opens a new window all kinds of errors follow. (Xavier Deguillard) Solution: When 'completefunc' goes to another window or buffer and when it deletes text abort completion. Add a test for 'completefunc'.
This commit is contained in:
41
src/edit.c
41
src/edit.c
@@ -58,6 +58,10 @@ static char *ctrl_x_msgs[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
static char e_hitend[] = N_("Hit end of paragraph");
|
static char e_hitend[] = N_("Hit end of paragraph");
|
||||||
|
#ifdef FEAT_COMPL_FUNC
|
||||||
|
static char e_complwin[] = N_("E839: Completion function changed window");
|
||||||
|
static char e_compldel[] = N_("E840: Completion function deleted text");
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Structure used to store one match for insert completion.
|
* Structure used to store one match for insert completion.
|
||||||
@@ -3833,6 +3837,8 @@ expand_by_function(type, base)
|
|||||||
char_u *args[2];
|
char_u *args[2];
|
||||||
char_u *funcname;
|
char_u *funcname;
|
||||||
pos_T pos;
|
pos_T pos;
|
||||||
|
win_T *curwin_save;
|
||||||
|
buf_T *curbuf_save;
|
||||||
|
|
||||||
funcname = (type == CTRL_X_FUNCTION) ? curbuf->b_p_cfu : curbuf->b_p_ofu;
|
funcname = (type == CTRL_X_FUNCTION) ? curbuf->b_p_cfu : curbuf->b_p_ofu;
|
||||||
if (*funcname == NUL)
|
if (*funcname == NUL)
|
||||||
@@ -3843,12 +3849,26 @@ expand_by_function(type, base)
|
|||||||
args[1] = base;
|
args[1] = base;
|
||||||
|
|
||||||
pos = curwin->w_cursor;
|
pos = curwin->w_cursor;
|
||||||
|
curwin_save = curwin;
|
||||||
|
curbuf_save = curbuf;
|
||||||
matchlist = call_func_retlist(funcname, 2, args, FALSE);
|
matchlist = call_func_retlist(funcname, 2, args, FALSE);
|
||||||
|
if (curwin_save != curwin || curbuf_save != curbuf)
|
||||||
|
{
|
||||||
|
EMSG(_(e_complwin));
|
||||||
|
goto theend;
|
||||||
|
}
|
||||||
curwin->w_cursor = pos; /* restore the cursor position */
|
curwin->w_cursor = pos; /* restore the cursor position */
|
||||||
if (matchlist == NULL)
|
check_cursor();
|
||||||
return;
|
if (!equalpos(curwin->w_cursor, pos))
|
||||||
|
{
|
||||||
|
EMSG(_(e_compldel));
|
||||||
|
goto theend;
|
||||||
|
}
|
||||||
|
if (matchlist != NULL)
|
||||||
ins_compl_add_list(matchlist);
|
ins_compl_add_list(matchlist);
|
||||||
|
|
||||||
|
theend:
|
||||||
|
if (matchlist != NULL)
|
||||||
list_unref(matchlist);
|
list_unref(matchlist);
|
||||||
}
|
}
|
||||||
#endif /* FEAT_COMPL_FUNC */
|
#endif /* FEAT_COMPL_FUNC */
|
||||||
@@ -4994,6 +5014,8 @@ ins_complete(c)
|
|||||||
int col;
|
int col;
|
||||||
char_u *funcname;
|
char_u *funcname;
|
||||||
pos_T pos;
|
pos_T pos;
|
||||||
|
win_T *curwin_save;
|
||||||
|
buf_T *curbuf_save;
|
||||||
|
|
||||||
/* Call 'completefunc' or 'omnifunc' and get pattern length as a
|
/* Call 'completefunc' or 'omnifunc' and get pattern length as a
|
||||||
* string */
|
* string */
|
||||||
@@ -5009,8 +5031,21 @@ ins_complete(c)
|
|||||||
args[0] = (char_u *)"1";
|
args[0] = (char_u *)"1";
|
||||||
args[1] = NULL;
|
args[1] = NULL;
|
||||||
pos = curwin->w_cursor;
|
pos = curwin->w_cursor;
|
||||||
|
curwin_save = curwin;
|
||||||
|
curbuf_save = curbuf;
|
||||||
col = call_func_retnr(funcname, 2, args, FALSE);
|
col = call_func_retnr(funcname, 2, args, FALSE);
|
||||||
|
if (curwin_save != curwin || curbuf_save != curbuf)
|
||||||
|
{
|
||||||
|
EMSG(_(e_complwin));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
curwin->w_cursor = pos; /* restore the cursor position */
|
curwin->w_cursor = pos; /* restore the cursor position */
|
||||||
|
check_cursor();
|
||||||
|
if (!equalpos(curwin->w_cursor, pos))
|
||||||
|
{
|
||||||
|
EMSG(_(e_compldel));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
if (col < 0)
|
if (col < 0)
|
||||||
col = curs_col;
|
col = curs_col;
|
||||||
|
@@ -27,7 +27,8 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
|
|||||||
test56.out test57.out test58.out test59.out test60.out \
|
test56.out test57.out test58.out test59.out test60.out \
|
||||||
test61.out test62.out test63.out test64.out test65.out \
|
test61.out test62.out test63.out test64.out test65.out \
|
||||||
test66.out test67.out test68.out test69.out test70.out \
|
test66.out test67.out test68.out test69.out test70.out \
|
||||||
test71.out test72.out test73.out test74.out test75.out
|
test71.out test72.out test73.out test74.out test75.out \
|
||||||
|
test76.out
|
||||||
|
|
||||||
.SUFFIXES: .in .out
|
.SUFFIXES: .in .out
|
||||||
|
|
||||||
@@ -122,3 +123,4 @@ test72.out: test72.in
|
|||||||
test73.out: test73.in
|
test73.out: test73.in
|
||||||
test74.out: test74.in
|
test74.out: test74.in
|
||||||
test75.out: test75.in
|
test75.out: test75.in
|
||||||
|
test76.out: test76.in
|
||||||
|
@@ -28,7 +28,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
|
|||||||
test37.out test38.out test39.out test40.out test41.out \
|
test37.out test38.out test39.out test40.out test41.out \
|
||||||
test42.out test52.out test65.out test66.out test67.out \
|
test42.out test52.out test65.out test66.out test67.out \
|
||||||
test68.out test69.out test71.out test72.out test73.out \
|
test68.out test69.out test71.out test72.out test73.out \
|
||||||
test74.out test75.out
|
test74.out test75.out test76.out
|
||||||
|
|
||||||
SCRIPTS32 = test50.out test70.out
|
SCRIPTS32 = test50.out test70.out
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
|
|||||||
test37.out test38.out test39.out test40.out test41.out \
|
test37.out test38.out test39.out test40.out test41.out \
|
||||||
test42.out test52.out test65.out test66.out test67.out \
|
test42.out test52.out test65.out test66.out test67.out \
|
||||||
test68.out test69.out test71.out test72.out test73.out \
|
test68.out test69.out test71.out test72.out test73.out \
|
||||||
test74.out test75.out
|
test74.out test75.out test76.out
|
||||||
|
|
||||||
SCRIPTS32 = test50.out test70.out
|
SCRIPTS32 = test50.out test70.out
|
||||||
|
|
||||||
|
@@ -27,7 +27,8 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
|
|||||||
test56.out test57.out test58.out test59.out test60.out \
|
test56.out test57.out test58.out test59.out test60.out \
|
||||||
test61.out test62.out test63.out test64.out test65.out \
|
test61.out test62.out test63.out test64.out test65.out \
|
||||||
test66.out test67.out test68.out test69.out test70.out \
|
test66.out test67.out test68.out test69.out test70.out \
|
||||||
test71.out test72.out test73.out test74.out test75.out
|
test71.out test72.out test73.out test74.out test75.out \
|
||||||
|
test76.out
|
||||||
|
|
||||||
.SUFFIXES: .in .out
|
.SUFFIXES: .in .out
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
|
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
|
||||||
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
|
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
|
||||||
#
|
#
|
||||||
# Last change: 2010 Oct 20
|
# Last change: 2010 Nov 10
|
||||||
#
|
#
|
||||||
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
|
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
|
||||||
# Edit the lines in the Configuration section below to select.
|
# Edit the lines in the Configuration section below to select.
|
||||||
@@ -74,7 +74,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
|
|||||||
test56.out test57.out test60.out \
|
test56.out test57.out test60.out \
|
||||||
test61.out test62.out test63.out test64.out test65.out \
|
test61.out test62.out test63.out test64.out test65.out \
|
||||||
test66.out test67.out test68.out test69.out \
|
test66.out test67.out test68.out test69.out \
|
||||||
test71.out test72.out test74.out test75.out
|
test71.out test72.out test74.out test75.out test76.out
|
||||||
|
|
||||||
# Known problems:
|
# Known problems:
|
||||||
# Test 30: a problem around mac format - unknown reason
|
# Test 30: a problem around mac format - unknown reason
|
||||||
|
@@ -25,7 +25,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
|
|||||||
test59.out test60.out test61.out test62.out test63.out \
|
test59.out test60.out test61.out test62.out test63.out \
|
||||||
test64.out test65.out test66.out test67.out test68.out \
|
test64.out test65.out test66.out test67.out test68.out \
|
||||||
test69.out test70.out test71.out test72.out test73.out \
|
test69.out test70.out test71.out test72.out test73.out \
|
||||||
test74.out test75.out
|
test74.out test75.out test76.out
|
||||||
|
|
||||||
SCRIPTS_GUI = test16.out
|
SCRIPTS_GUI = test16.out
|
||||||
|
|
||||||
|
@@ -714,6 +714,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
52,
|
||||||
/**/
|
/**/
|
||||||
51,
|
51,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user