mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +00:00
Merge #7855 from ckelsel/vim-8.0.0398
This commit is contained in:
@@ -3366,6 +3366,10 @@ set_context_in_map_cmd (
|
||||
arg = skipwhite(arg + 8);
|
||||
continue;
|
||||
}
|
||||
if (STRNCMP(arg, "<special>", 9) == 0) {
|
||||
arg = skipwhite(arg + 9);
|
||||
continue;
|
||||
}
|
||||
if (STRNCMP(arg, "<script>", 8) == 0) {
|
||||
arg = skipwhite(arg + 8);
|
||||
continue;
|
||||
@@ -3408,21 +3412,24 @@ int ExpandMappings(regmatch_T *regmatch, int *num_file, char_u ***file)
|
||||
for (round = 1; round <= 2; ++round) {
|
||||
count = 0;
|
||||
|
||||
for (i = 0; i < 6; ++i) {
|
||||
if (i == 0)
|
||||
for (i = 0; i < 7; i++) {
|
||||
if (i == 0) {
|
||||
p = (char_u *)"<silent>";
|
||||
else if (i == 1)
|
||||
} else if (i == 1) {
|
||||
p = (char_u *)"<unique>";
|
||||
else if (i == 2)
|
||||
} else if (i == 2) {
|
||||
p = (char_u *)"<script>";
|
||||
else if (i == 3)
|
||||
} else if (i == 3) {
|
||||
p = (char_u *)"<expr>";
|
||||
else if (i == 4 && !expand_buffer)
|
||||
} else if (i == 4 && !expand_buffer) {
|
||||
p = (char_u *)"<buffer>";
|
||||
else if (i == 5)
|
||||
} else if (i == 5) {
|
||||
p = (char_u *)"<nowait>";
|
||||
else
|
||||
} else if (i == 6) {
|
||||
p = (char_u *)"<special>";
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (vim_regexec(regmatch, p, (colnr_T)0)) {
|
||||
if (round == 1)
|
||||
|
@@ -749,8 +749,9 @@ open_line (
|
||||
// Postpone calling changed_lines(), because it would mess up folding
|
||||
// with markers.
|
||||
// Skip mark_adjust when adding a line after the last one, there can't
|
||||
// be marks there.
|
||||
if (curwin->w_cursor.lnum + 1 < curbuf->b_ml.ml_line_count) {
|
||||
// be marks there. But still needed in diff mode.
|
||||
if (curwin->w_cursor.lnum + 1 < curbuf->b_ml.ml_line_count
|
||||
|| curwin->w_p_diff) {
|
||||
mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L, false);
|
||||
}
|
||||
did_append = true;
|
||||
@@ -1864,8 +1865,8 @@ void appended_lines(linenr_T lnum, long count)
|
||||
void appended_lines_mark(linenr_T lnum, long count)
|
||||
{
|
||||
// Skip mark_adjust when adding a line after the last one, there can't
|
||||
// be marks there.
|
||||
if (lnum + count < curbuf->b_ml.ml_line_count) {
|
||||
// be marks there. But it's still needed in diff mode.
|
||||
if (lnum + count < curbuf->b_ml.ml_line_count || curwin->w_p_diff) {
|
||||
mark_adjust(lnum + 1, (linenr_T)MAXLNUM, count, 0L, false);
|
||||
}
|
||||
changed_lines(lnum + 1, 0, lnum + 1, count);
|
||||
|
@@ -3177,9 +3177,9 @@ error:
|
||||
curbuf->b_op_start.lnum++;
|
||||
}
|
||||
// Skip mark_adjust when adding lines after the last one, there
|
||||
// can't be marks there.
|
||||
// can't be marks there. But still needed in diff mode.
|
||||
if (curbuf->b_op_start.lnum + (y_type == kMTCharWise) - 1 + nr_lines
|
||||
< curbuf->b_ml.ml_line_count) {
|
||||
< curbuf->b_ml.ml_line_count || curwin->w_p_diff) {
|
||||
mark_adjust(curbuf->b_op_start.lnum + (y_type == kMTCharWise),
|
||||
(linenr_T)MAXLNUM, nr_lines, 0L, false);
|
||||
}
|
||||
|
@@ -1382,13 +1382,13 @@ int searchc(cmdarg_T *cap, int t_cmd)
|
||||
col -= (*mb_head_off)(p, p + col - 1) + 1;
|
||||
}
|
||||
if (lastc_bytelen == 1) {
|
||||
if (p[col] == c && stop)
|
||||
break;
|
||||
} else {
|
||||
if (memcmp(p + col, lastc_bytes, lastc_bytelen) == 0 && stop)
|
||||
if (p[col] == c && stop) {
|
||||
break;
|
||||
}
|
||||
stop = TRUE;
|
||||
} else if (STRNCMP(p + col, lastc_bytes, lastc_bytelen) == 0 && stop) {
|
||||
break;
|
||||
}
|
||||
stop = true;
|
||||
}
|
||||
} else {
|
||||
for (;; ) {
|
||||
|
@@ -25,6 +25,26 @@ func Test_complete_wildmenu()
|
||||
set nowildmenu
|
||||
endfunc
|
||||
|
||||
func Test_map_completion()
|
||||
if !has('cmdline_compl')
|
||||
return
|
||||
endif
|
||||
call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt')
|
||||
call assert_equal('"map <unique> <silent>', getreg(':'))
|
||||
call feedkeys(":map <script> <un\<Tab>\<Home>\"\<CR>", 'xt')
|
||||
call assert_equal('"map <script> <unique>', getreg(':'))
|
||||
call feedkeys(":map <expr> <sc\<Tab>\<Home>\"\<CR>", 'xt')
|
||||
call assert_equal('"map <expr> <script>', getreg(':'))
|
||||
call feedkeys(":map <buffer> <e\<Tab>\<Home>\"\<CR>", 'xt')
|
||||
call assert_equal('"map <buffer> <expr>', getreg(':'))
|
||||
call feedkeys(":map <nowait> <b\<Tab>\<Home>\"\<CR>", 'xt')
|
||||
call assert_equal('"map <nowait> <buffer>', getreg(':'))
|
||||
call feedkeys(":map <special> <no\<Tab>\<Home>\"\<CR>", 'xt')
|
||||
call assert_equal('"map <special> <nowait>', getreg(':'))
|
||||
call feedkeys(":map <silent> <sp\<Tab>\<Home>\"\<CR>", 'xt')
|
||||
call assert_equal('"map <silent> <special>', getreg(':'))
|
||||
endfunc
|
||||
|
||||
func Test_expr_completion()
|
||||
if !(has('cmdline_compl') && has('eval'))
|
||||
return
|
||||
|
@@ -272,3 +272,23 @@ func Test_setting_cursor()
|
||||
call delete('Xtest1')
|
||||
call delete('Xtest2')
|
||||
endfunc
|
||||
|
||||
func Test_diff_lastline()
|
||||
enew!
|
||||
only!
|
||||
call setline(1, ['This is a ', 'line with five ', 'rows'])
|
||||
diffthis
|
||||
botright vert new
|
||||
call setline(1, ['This is', 'a line with ', 'four rows'])
|
||||
diffthis
|
||||
1
|
||||
call feedkeys("Je a\<CR>", 'tx')
|
||||
call feedkeys("Je a\<CR>", 'tx')
|
||||
let w1lines = winline()
|
||||
wincmd w
|
||||
$
|
||||
let w2lines = winline()
|
||||
call assert_equal(w2lines, w1lines)
|
||||
bwipe!
|
||||
bwipe!
|
||||
endfunc
|
||||
|
@@ -298,3 +298,10 @@ func Test_searchpair()
|
||||
q!
|
||||
endfunc
|
||||
|
||||
func Test_searchc()
|
||||
" These commands used to cause memory overflow in searchc().
|
||||
new
|
||||
norm ixx
|
||||
exe "norm 0t\u93cf"
|
||||
bw!
|
||||
endfunc
|
||||
|
Reference in New Issue
Block a user