Merge remote-tracking branch 'vim/master'

This commit is contained in:
Kazuki Sakamoto
2016-10-16 09:19:19 -07:00
5 changed files with 63 additions and 26 deletions
+2 -4
View File
@@ -2808,9 +2808,6 @@ set_completion(colnr_T startcol, list_T *list)
ins_compl_prep(' ');
ins_compl_clear();
if (stop_arrow() == FAIL)
return;
compl_direction = FORWARD;
if (startcol > curwin->w_cursor.col)
startcol = curwin->w_cursor.col;
@@ -3890,7 +3887,8 @@ ins_compl_prep(int c)
/* put the cursor on the last char, for 'tw' formatting */
if (prev_col > 0)
dec_cursor();
if (stop_arrow() == OK)
/* only format when something was inserted */
if (!arrow_used && !ins_need_undo)
insertchar(NUL, 0, -1);
if (prev_col > 0
&& ml_get_curline()[curwin->w_cursor.col] != NUL)
+22 -21
View File
@@ -7786,6 +7786,10 @@ next_search_hl(
}
}
/*
* If there is a match fill "shl" and return one.
* Return zero otherwise.
*/
static int
next_search_hl_pos(
match_T *shl, /* points to a match */
@@ -7794,55 +7798,52 @@ next_search_hl_pos(
colnr_T mincol) /* minimal column for a match */
{
int i;
int bot = -1;
int found = -1;
shl->lnum = 0;
for (i = posmatch->cur; i < MAXPOSMATCH; i++)
{
llpos_T *pos = &posmatch->pos[i];
if (pos->lnum == 0)
break;
if (pos->col + pos->len - 1 <= mincol)
if (pos->len == 0 && pos->col < mincol)
continue;
if (pos->lnum == lnum)
{
if (shl->lnum == lnum)
if (found >= 0)
{
/* partially sort positions by column numbers
* on the same line */
if (pos->col < posmatch->pos[bot].col)
/* if this match comes before the one at "found" then swap
* them */
if (pos->col < posmatch->pos[found].col)
{
llpos_T tmp = *pos;
*pos = posmatch->pos[bot];
posmatch->pos[bot] = tmp;
*pos = posmatch->pos[found];
posmatch->pos[found] = tmp;
}
}
else
{
bot = i;
shl->lnum = lnum;
}
found = i;
}
}
posmatch->cur = 0;
if (shl->lnum == lnum && bot >= 0)
if (found >= 0)
{
colnr_T start = posmatch->pos[bot].col == 0
? 0 : posmatch->pos[bot].col - 1;
colnr_T end = posmatch->pos[bot].col == 0
? MAXCOL : start + posmatch->pos[bot].len;
colnr_T start = posmatch->pos[found].col == 0
? 0 : posmatch->pos[found].col - 1;
colnr_T end = posmatch->pos[found].col == 0
? MAXCOL : start + posmatch->pos[found].len;
shl->lnum = lnum;
shl->rm.startpos[0].lnum = 0;
shl->rm.startpos[0].col = start;
shl->rm.endpos[0].lnum = 0;
shl->rm.endpos[0].col = end;
shl->is_addpos = TRUE;
posmatch->cur = bot + 1;
return TRUE;
posmatch->cur = found + 1;
return 1;
}
return FALSE;
return 0;
}
#endif
+8
View File
@@ -191,7 +191,15 @@ func Test_matchaddpos()
call assert_equal(screenattr(2,2), screenattr(1,7))
call assert_notequal(screenattr(2,2), screenattr(1,8))
call clearmatches()
call matchaddpos('Error', [[1], [2,2]])
redraw!
call assert_equal(screenattr(2,2), screenattr(1,1))
call assert_equal(screenattr(2,2), screenattr(1,10))
call assert_notequal(screenattr(2,2), screenattr(1,11))
nohl
call clearmatches()
syntax off
set hlsearch&
endfunc
+27 -1
View File
@@ -378,7 +378,7 @@ func DummyCompleteFour(findstart, base)
endif
endfunc
:"Test that 'completefunc' works when it's OK.
" Test that 'completefunc' works when it's OK.
func Test_omnifunc_with_check()
new
setlocal omnifunc=DummyCompleteFour
@@ -400,4 +400,30 @@ func Test_omnifunc_with_check()
q!
endfunc
function UndoComplete()
call complete(1, ['January', 'February', 'March',
\ 'April', 'May', 'June', 'July', 'August', 'September',
\ 'October', 'November', 'December'])
return ''
endfunc
" Test that no undo item is created when no completion is inserted
func Test_complete_no_undo()
set completeopt=menu,preview,noinsert,noselect
inoremap <Right> <C-R>=UndoComplete()<CR>
new
call feedkeys("ixxx\<CR>\<CR>yyy\<Esc>k", 'xt')
call feedkeys("iaaa\<Esc>0", 'xt')
call assert_equal('aaa', getline(2))
call feedkeys("i\<Right>\<Esc>", 'xt')
call assert_equal('aaa', getline(2))
call feedkeys("u", 'xt')
call assert_equal('', getline(2))
iunmap <Right>
set completeopt&
q!
endfunc
" vim: shiftwidth=2 sts=2 expandtab
+4
View File
@@ -779,6 +779,10 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
41,
/**/
40,
/**/
39,
/**/